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
#!/bin/bash | |
# Uses awk to do the comparison so it can handle floating point numbers | |
awke() | |
{ | |
echo "$1 $3" | awk '{ print ($1 '"$2"' $2) }' | |
} | |
awke '3.124' '*' '6' |
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
# you can add this little gem to your .bash_profile to run a command inside of each directory in the current folder | |
# eg: foreachdir 'git status' | |
foreachdir() { /usr/bin/find . -type d -mindepth 1 -maxdepth 1 -exec sh -c "(cd {} && echo '\033[0;31m// '\$PWD'------>\033[0m' && $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
ngreplocalport(){ | |
sudo ngrep -q -W byline -d lo0 '' "port $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
_list_from_file() | |
{ | |
local curr_arg; | |
curr_arg=${COMP_WORDS[COMP_CWORD]} | |
filelines=$(cat /some/file) | |
COMPREPLY=( $(compgen -W "$filelines" -- $curr_arg) ); | |
} |
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
usefulbashping() | |
{ | |
read loss rttavg <<< $(ping -q -c 100 -w 60 -A $1 | \ | |
awk 'BEGIN {FS="[/ ]"}; /loss/ {print substr($6,0,length($6))}; /rtt/ {print $9*1000}') | |
} |
NewerOlder