This file contains hidden or 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
| #!/usr/bin/env php | |
| <?php | |
| function getDownloadPathWindows() | |
| { | |
| $home = getenv('HOMEDRIVE') . getenv('HOMEPATH'); | |
| if (!is_dir($home)) { | |
| throw new RuntimeException("No home folder $home"); | |
| } | |
| return "$home/Pictures/Bing"; |
This file contains hidden or 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
| set autoident | |
| set tabsize 4 | |
| set tabstospaces | |
| set multibuffer | |
| set smarthome | |
| set whitespace "»·" | |
| set const | |
| set historylog | |
| set mouse | |
| set poslog |
This file contains hidden or 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
| # http://stackoverflow.com/a/11426261 | |
| cd repository | |
| git log --pretty=email --patch-with-stat --reverse --full-index --binary -- path/to/file_or_folder > patch | |
| cd ../another_repository | |
| git am < ../repository/patch |
This file contains hidden or 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
| make -qrpn | sed -n -e '/^$/ { n ; /^[^ ]*:/p; }' | sort | egrep --color '^[^ .]*:' |
This file contains hidden or 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
| git log --graph --oneline --all --decorate |
This file contains hidden or 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 . -name '*.php' ! -type d -exec bash -c 'expand -i -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \; |
This file contains hidden or 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
| function isArray(o) { | |
| return Object.prototype.toString.call(o) === '[object Array]'; | |
| } |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # Taken and modified from | |
| # http://www.thepowerbase.com/2015/04/install-visual-studio-code-ubuntu-14-04-14-10-15-04/ | |
| DOWNLOAD_URL=https://az764295.vo.msecnd.net/public/0.10.2/VSCode-linux64.zip | |
| VSCODE_DIR=/opt/VSCode | |
| DESKTOP_FILE_PATH=/usr/share/applications/visualstudiocode.desktop | |
| ICON_FILE_PATH=$VSCODE_DIR/resources/app/resources/linux/vscode.png | |
| TMP_DIR=/tmp/VSCode |
This file contains hidden or 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
| function renderPhpFile($filename, $vars = null) { | |
| if (is_array($vars) && !empty($vars)) { | |
| extract($vars); | |
| } | |
| ob_start(); | |
| include $filename; | |
| return ob_get_clean(); | |
| } | |
| // usage |
This file contains hidden or 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
| free | awk '/buffers\/cache/{print $3/($3+$4) * 100.0;}' |