This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# execute command on behave of another user | |
$ su -s /bin/sh <username> -c "whoami" | |
# become another user: | |
$ sudo su - <username> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE `<database name>`; | |
CREATE USER '<database user>'@'localhost' IDENTIFIED BY '<password>'; | |
GRANT ALL ON <database name>.* TO '<database user>'@'localhost'; | |
FLUSH PRIVILEGES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find Mac files | |
$ sudo find folder-location/ -iname "._*" -exec rm {} \; | |
# find Mac files #2 | |
$ sudo find folder-location/ -iname ".DS_Store" -exec rm {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return (count($array) !== count($array, COUNT_RECURSIVE)) ? true : false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo tcpdump -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' | |
$ tcpdump -i <interface> -s 0 -A host <host> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tar: | |
# -z : Compress archive using gzip program | |
# -c: Create archive | |
# -v: Verbose i.e display progress while creating archive | |
# -f: Archive File name | |
$ tar -zcvf archive-name.tar.gz directory-name | |
# untar: | |
# -x: Extract files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mysqldump -d -P 3306 -h [ip adrr host] -u[username] -p[password] [db_name] > [filename].sql | |
# -d, --no-data No row information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# how to retrieve the hash for the current commit in Git? | |
$ git rev-parse HEAD | |
# how do I delete a tag from a Git repo? | |
$ git tag -d release01 | |
$ git push origin :refs/tags/release01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To copy a file from B to A while logged into B: | |
$ scp /path/to/file username@a:/path/to/destination | |
# To copy a file from B to A while logged into A: | |
$ scp username@b:/path/to/file /path/to/destination |
OlderNewer