Skip to content

Instantly share code, notes, and snippets.

@tracertea
tracertea / xargs:stop_xargs_execution
Created Mar 20, 2018
Stop xargs from performing further processing when event is triggered
View xargs:stop_xargs_execution
seq 1 30 | xargs -I {} bash -c 'if [ "$0" == "10" ]; then exit 255; fi; echo $0' {}
@tracertea
tracertea / sed:multiple_replacements
Created Mar 20, 2018
perform multiple replacements in a single sed
View sed:multiple_replacements
| sed -e 's/:80//g; s/:443//g'
@tracertea
tracertea / javascript:rewrite_address_bar
Created Sep 14, 2016
Rewrite the contents of the address bar.
View javascript:rewrite_address_bar
window.history.pushState("", "", '/login');
@tracertea
tracertea / sh:param_to_multiple_commands
Created Sep 8, 2015
Pass a parameter to multiple commands
View sh:param_to_multiple_commands
find . -type f ! -name '*.strings' -exec sh -c 'strings $0 > $0.strings' {} \;
@tracertea
tracertea / xargs,sh:multi_param_commands
Created Sep 8, 2015
Run batch multi parameter commands
View xargs,sh:multi_param_commands
cat myFile.txt | xargs -I {} sh -c 'p=(`echo $0`); echo ${p[1]} ${p[0]}' {}
@tracertea
tracertea / find,rsync:copy_keep_directory_structure
Created Jul 7, 2015
Copy files maintaining directory structure
View find,rsync:copy_keep_directory_structure
find . -type f -iname "*.java" -o -iname "*.cpp" -exec rsync -R {} /DESTINATION/PATH \;
@tracertea
tracertea / find:delete_empty_subdirectories
Last active Aug 29, 2015
delete all empty sub directoires
View find:delete_empty_subdirectories
find . -type d -empty -delete
@tracertea
tracertea / fuser:port_to_pid
Created Dec 29, 2014
display the process id associated with a port
@tracertea
tracertea / find,echo,plutil:plist_dump
Created Oct 30, 2014
display the contents of all plist files within a directory recursively OSX
View find,echo,plutil:plist_dump
find . -name "*.plist" -exec echo {} \; -exec plutil -p {} \;