Quick Notes

Git

How to rebase your branch

1
2
git checkout branchname
git rebase master

Change local user name

1
2
git config user.name "Your name"
git config user.email "Your email"

Synchronise git branch with master

Git Forks And Upstreams

1
2
3
4
5
git checkout branchname
# some work and some commits
# some time passes
git fetch upstream
git rebase upstream/master

Sychronise git master

1
2
3
git checkout master
git fetch upstream
git merge upstream/master (or git rebase upstream/master)

Delete the commit on remote github

See here

First remove the last commit

1
git rebase -i HEAD~2 ( Or use the option in IDE )

Force push

1
git push origin +branchname --force

Worktree

It is useful when you want to push a folder to a different branch.
For example, push public/ to gh-pages

1
git worktree add -B gh-pages public upstream/gh-pages

Network

check port being forwarded

1
netstat -tpln

ssh without password

1
2
3
ssh-keygen -t rsa(with default config)
ssh-copy-id root@172.100.51.192
ssh root@ip.address

overwatch tcp call

Tool: tcpdump

1
tcpdump -i vmgmt port http and dst www.heise.de

download from remote host

1
scp your_username@remotehost.edu:foobar.txt /local/dir

System

unmount busy device

1
umount -l /path/to/busy-device

unmount busy nfs

1
umount -f /path/to/busy-network-file-system

write random data to file

1
2
dd if=/dev/urandom of=sample.txt bs=1G count=1
dd if=/dev/urandom of=sample.txt bs=64M count=16

firewall

1
2
/etc/init.d/firewall start
/etc/init.d/firewall stop

Database

1
2
show databases;
GRANT ALL ON `DATABASE`.* TO 'user'@'localhost' IDENTIFIED BY 'password';