Skip to content

Commit

Permalink
many changes
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsiryk committed Feb 1, 2017
1 parent b44f0b3 commit bbfb0d5
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 27 deletions.
Empty file.
13 changes: 13 additions & 0 deletions Docker/docker_highlight_xed_gedit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
========================================
Gedit and xed docker syntax highlighting
========================================


https://github.com/mrorgues/gedit-xed-docker-syntax-highlighting


::

wget -q https://raw.githubusercontent.com/mrorgues/gedit-xed-docker-syntax-highlighting/master/docker.lang
sudo mv -i docker.lang /usr/share/gtksourceview-3.0/language-specs/docker.lang
sudo chmod 644 /usr/share/gtksourceview-3.0/language-specs/docker.lang
8 changes: 8 additions & 0 deletions Elastic/elasticsearch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ Start/restart Elasticsearch::

sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service


Old indexes clear
-----------------

- http://www.ragingcomputer.com/2014/02/removing-old-records-for-logstash-elasticsearch-kibana
- https://www.elastic.co/guide/en/elasticsearch/client/curator/current/singleton-cli.html
- https://www.elastic.co/blog/curator-tending-your-time-series-indices
69 changes: 69 additions & 0 deletions cloning_disk.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
=============
Clonning disk
=============

This instructions about how you can clone full your physical disk to another physical disk.

**https://wiki.archlinux.org/index.php/disk_cloning**


dd (clonning)
-------------

This will clone the entire drive, including the MBR (and therefore bootloader), all partitions, UUIDs, and data::

dd if=/dev/sdX of=/dev/sdX bs=32M conv=sync,noerror


- ``noerror`` instructs dd to continue operation, ignoring all read errors. Default behavior for dd is to halt at any error.
- ``sync`` fills input blocks with zeroes if there were any read errors, so data offsets stay in sync.
- ``bs=`` sets the block size. Defaults to ``512 bytes``, which is the "classic" block size for hard drives since the early 1980s, but is not the most convenient. Use a bigger value, 64K or 128K.

.. note::

If you are positive that your disk does not contain any errors, you could proceed using a larger block size, which will increase the speed of your copying several fold. For example, changing bs from 512 to 64K changed copying speed from 35 MB/s to 120 MB/s on a simple Celeron 2.7 GHz system. But keep in mind that read errors on the source disk will end up as block errors on the destination disk, i.e. a single 512-byte read error will mess up the whole 64 KiB output block.


.. note::

If you would like to view dd progressing, use the ``status=progress`` option.



Maybe faster (not testing)::

dd if=/dev/sda | dd of=/dev/sdb


cat (clonning)
--------------

Clonning with **cat**::

cat /dev/sda > /dev/sdb


If you want to run this command in sudo, you need to make the redirection happen as root::

sudo sh -c 'cat /dev/sdb >/dev/sdc'


pv (clonning)
--------------

If you want a progress report and your unix variant doesn't provide an easy way to get at a file descriptor positions, you can install and use pv instead of cat::

pv /dev/sda > /dev/sdb


Backuping in file
-----------------

To save space, you can compress data produced by dd with gzip, e.g.::

dd if=/dev/hdb | gzip -c > /image.img


You can restore your disk with::

gunzip -c /image.img.gz | dd of=/dev/hdb
56 changes: 56 additions & 0 deletions haproxy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
=======
HAProxy
=======

- Check repository for your OS: https://haproxy.debian.net/
- Documentation: http://www.haproxy.org/download/1.7/doc/configuration.txt


Add header if ssl::

http-request add-header X-Forwarded-Proto https if { ssl_fc }


Check config::

haproxy -c -f /etc/haproxy/haproxy.cfg



haproxy.cfg::

frontend fe

# HTTP log format format, which is the most advanced for HTTP proxying.
# It provides the same information as the TCP format with some HTTP-specific fields such as the request, the status code, and captures of headers and cookies.
# This format is recommended for HTTP proxies.
option httplog

backend be

stick-table type string len 32 size 1M peers haproxy-peers
# type string len 32 - String 32 characters
# size 1M - maximum number of entries that can fit in the table. Count approximately 50 bytes per entry, plus the size of a string if any.
# The size supports suffixes "k", "m", "g" for 2^10, 2^20 and 2^30 factors.

# Define a request pattern to associate a user to a server
stick on req.cook(SERVERID)

# Define a request pattern matching condition to stick a user to a server
stick match <pattern> [table <table>] [{if | unless} <cond>]



Geolocation
-----------

- http://agiletesting.blogspot.com/2014/01/geolocation-detection-with-haproxy.html
- http://blog.haproxy.com/2012/07/02/use-geoip-database-within-haproxy/


Sticky session
--------------

- http://blog.haproxy.com/2012/03/29/load-balancing-affinity-persistence-sticky-sessions-what-you-need-to-know/
- https://docs.oracle.com/cd/E37670_01/E41138/html/section_jyh_zhz_4r.html
-
21 changes: 13 additions & 8 deletions hdd_speed_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
Test HDD speed in Linux
=======================

ТЕСТ Скорости ЗАПИСИ Жесткого Диска - «dd»
------------------------------------------
Write speed (dd)
----------------

::

$ sync; dd if=/dev/zero of=tempfile bs=1M count=1024; sync
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 3.28696 s, 327 MB/s
sync; dd if=/dev/zero of=tempfile bs=1M count=1024; sync

# 1024+0 records in
# 1024+0 records out
# 1073741824 bytes (1.1 GB) copied, 3.28696 s, 327 MB/s

# if you want to delete created tempfile
rm tempfile



ТЕСТ Скорости ЧТЕНИЯ Жесткого Диска - «dd»
------------------------------------------
Read speed (dd)
---------------

tempfile, был закэширован в буфер и скорость его чтения будет выше чем реальная . Чтобы получить реальную скорость, необходимо очистить кэш.
Выполни следующую команду, чтобы узнать Скорость ЧТЕНИЯ из Буфера::
Expand Down
15 changes: 8 additions & 7 deletions linux_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,16 @@ sudo ifconfig wlan0 down && sudo ifconfig wlan0 up // перезапуск netwo

wget -qO- 127.0.0.1 # get and show page

::

grep -iR -E '(error_report|ini_set)' ./*.php # find in files
-l # show only file names
-i # ignore case sensetive
--exclude="*\.svn*" # exclude
--exclude-dir="dir" | {dir1,dir2} # exclude dir
grep -iR -E '(error_report|ini_set)' ./*.php # find in files
-l # show only file names
-i # ignore case sensetive
--exclude="*\.svn*" # exclude
--exclude-dir="dir" | {dir1,dir2} # exclude dir

# замена слов
grep -iRl -E "(DB_PASSWORD = 'YnB27GrWe')" | xargs sed -i "s/$DB_USER = 'root'/$DB_USER = 'u_passdiscount'/g"
Замена слов::
grep -iRl -E "(SOURCE)" | xargs sed -i "s/SOURCE/DEST/g"


# find
Expand Down
21 changes: 21 additions & 0 deletions python_simple_http_server.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
=======================
Python SimpleHTTPServer
=======================

::

sudo python -m SimpleHTTPServer 80


for python 3.x version, you may need ::

sudo python -m http.server 80


Ports below 1024 require root privileges.

As George added in a comment, running this command as root is not a good idea - it opens up all kinds of security vulnerabilities.

However, it answers the question.


23 changes: 11 additions & 12 deletions resume stopped process ctrl+z.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
Resume stopped process
======================

Resume stopped process::
Resume stopped process by **CTRL+Z** combination.

CTRL+Z
The general job control commands in Linux are::

The general job control commands in Linux are:

jobs - list the current jobs
fg - resume the job that's next in the queue
fg %[number] - resume job [number]
bg - Push the next job in the queue into the background
bg %[number] - Push the job [number] into the background
kill %[number] - Kill the job numbered [number]
kill -[signal] %[number] - Send the signal [signal] to job number [number]
disown %[number] - disown the process(no more terminal will be owner), so command will be alive even after closing the terminal.
jobs # list the current jobs
fg # resume the job that's next in the queue
fg %[number] # resume job [number]
bg # Push the next job in the queue into the background
bg %[number] # Push the job [number] into the background
kill %[number] # Kill the job numbered [number]
kill -[signal] %[number] # Send the signal [signal] to job number [number]
disown %[number] # disown the process(no more terminal will be owner), so command will be alive even after closing the terminal

0 comments on commit bbfb0d5

Please sign in to comment.