Skip to content

Instantly share code, notes, and snippets.

@tracertea
tracertea / find,rsync:copy_keep_directory_structure
Created July 7, 2015 21:12
Copy files maintaining directory structure
find . -type f -iname "*.java" -o -iname "*.cpp" -exec rsync -R {} /DESTINATION/PATH \;
@tracertea
tracertea / xargs,sh:multi_param_commands
Created September 8, 2015 18:26
Run batch multi parameter commands
cat myFile.txt | xargs -I {} sh -c 'p=(`echo $0`); echo ${p[1]} ${p[0]}' {}
@tracertea
tracertea / sh:param_to_multiple_commands
Created September 8, 2015 18:38
Pass a parameter to multiple commands
find . -type f ! -name '*.strings' -exec sh -c 'strings $0 > $0.strings' {} \;
@tracertea
tracertea / javascript:rewrite_address_bar
Created September 14, 2016 13:56
Rewrite the contents of the address bar.
window.history.pushState("", "", '/login');
@tracertea
tracertea / sed:multiple_replacements
Created March 20, 2018 16:37
perform multiple replacements in a single sed
| sed -e 's/:80//g; s/:443//g'
@tracertea
tracertea / xargs:stop_xargs_execution
Created March 20, 2018 16:45
Stop xargs from performing further processing when event is triggered
seq 1 30 | xargs -I {} bash -c 'if [ "$0" == "10" ]; then exit 255; fi; echo $0' {}