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
2 |
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 find-up { | |
x=`pwd` | |
result="" | |
while [ -z "$result" ] && [ "$x" != "/" ] ; do | |
result=$(find "$x" -maxdepth 1 -name $1) | |
x=`dirname "$x"` | |
done | |
echo $result | |
} |
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
# Add this function to your ~/.bash_profile file | |
# To show current linked version, run: `phpversion` | |
# To link another version, run: `phpversion VERSION` (e.g. `phpversion 7.2`) | |
phpversion() { | |
# Get currently installed HomeBrew php version (ignoring system php) | |
local current_php_version=$(/usr/local/bin/php -r "echo PHP_VERSION;" 2>/dev/null | awk -F'.' '{print "php@" $1 "." $2}') | |
# If no argument passed - Present the current version | |
if [ -z "$1" ]; then |
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 | |
get_branches="git branch | sort -u" | |
if [[ $# -eq 0 ]] ; then | |
eval "$get_branches | nl -ba" | |
exit; | |
fi | |
branch_num=$1 |
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 | |
cd ~/.ssh | |
function get_includes { | |
includes=$(cat $1 | awk '{$1=$1};1' | grep -i "^include\s" | perl -pe 's#^include\s+##i') | |
for config in $includes; do | |
echo $config | |
get_includes $config | |
done |
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 | |
curl -s ip-api.com/json | python -m json.tool |
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 | |
#set temp dir (from second arguments). defaults to __toupload | |
dest=${2:-__toupload} | |
dest=${dest%/}/ | |
to="HEAD" | |
# get start revision from first argument (default to -1) | |
from=${1:-1} |
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 | |
if [ $# -ne 2 ] && [ $# -ne 1 ]; then | |
echo "use: $0 source <destination>" | |
exit | |
fi | |
if [ ! -f $1 ]; then | |
printf "\e[31m$1\e[0m does not seem to be a file" |
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 node | |
const fs = require('fs'); | |
const path = require('path'); | |
function error(message) { | |
console.error(message); | |
process.exit(); | |
} |
NewerOlder