Skip to content

Instantly share code, notes, and snippets.

View kramarama's full-sized avatar
sand of time

Vladimir K kramarama

sand of time
  • /milkyway/solar/3
View GitHub Profile
ssh-keygen
cd ~/.ssh
ls -l
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
ls -ld ~/.ssh & ls -l ~/.ssh
ssh-copy-id -i id_rsa.pub root@ubuntu12
OR
cat ~/.ssh/id_rsa.pub | ssh user@host 'cat >> ~/.ssh/authorized_keys'
OR
https://help.ubuntu.com/12.04/serverguide/network-configuration.html
sudo mcedit /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.0.12
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-search rama.dev
iface eth0 inet6 static
address 2001:470:1f12:75a::1
netmask 64
gateway 2001:470:1f12:75a::2
auto he-ipv6
iface he-ipv6 inet6 v4tunnel
endpoint 216.66.84.42
address 2001:470:1f12:75a::2
netmask 64
2001:470:20::2 # he.net
2001:4860:4860::8844 # google
2001:4860:4860::8888 # google
# backup
# use --all-databases to backup all
mysqldump -uusername -ppassword -hlocalhost wordpress > ~/wp/database.sql
tar -czf backup.tar.gz /www/site/public_html ~/wp/database.sql
# restore
tar -xf backup.tar.gz
cd /www/site
rm -rf public_html
mv backups/public_html public_html
wget http://ru.wordpress.org/latest-ru_RU.tar.gz
wget http://wordpress.org/latest.tar.gz
tar -zvxf latest*.tar.gz
mv wordpress/* .
@kramarama
kramarama / sublime.textile
Last active August 29, 2015 14:03
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@kramarama
kramarama / mysql
Last active August 29, 2015 14:04
MySQL 101
sudo netstat -tap | grep mysql
mysql_secure_installation
$ echo X | telnet -e X 65.55.55.2 3306
$ nc -z -w1 65.55.55.2 3306
https://help.ubuntu.com/12.04/serverguide/mysql.html
**********************************************
* * Работа с бекапами
**********************************************
@kramarama
kramarama / ubuntu server 101
Last active August 29, 2015 14:04
Ubuntu Server 101
sudo traceroute -n -w 2 -q 2 -m 30 8.8.8.8
dig @8.8.8.8 www.example.com.
dig @2001:4860:4860::8888 www.example.com. AAAA
dig www.example.com. @4.2.2.1
sudo netstat -plunt
netstat -tuplen
nmcli dev list iface eth0 | grep IP4
@kramarama
kramarama / panels.ini
Last active August 29, 2015 14:04
mc panels
[New Left Panel]
display=listing
reverse=0
case_sensitive=1
exec_first=1
sort_order=name
list_mode=user
user_format=half type name | size:7 | mtime | type mode:4 | owner
user_status0=half type name | size | perm
user_status1=half type name | size | perm