clean my code: reloaded!
As always: some projects need a first (working) implementation and then over time you can improve them.
During lunch I was talking with a colleague about this tool. Then the idea to just use those actually changed files from the current implementation (means: the current branch in Git) shall be used as input. Et voila: consider it done!
Also added some fine-tuning to the call-parameter of the script itself, so it can be run as well with some custom string beside “todoM” (which is my marker).
Cleaning an implementation of properly tagged lines takes now a second – not minutes (like before!
Enjoy and have fun 🙂
Code can be found as always at https://github.com/marcelpetrick/cleanMyCode/blob/master/remove_todoM.sh
windows shell: some sleep-replacement
Ok, “wait” does not exist and “sleep” as well too.
Then there is the infamous ping-trick:
1 |
ping 127.0.0.1 -n 1 -w 1000 > NUL |
But the solution is:
1 |
timeout /nobreak /t 3 |
collection of hints for the easier use of cygwin
some better package-manager than via that set-up.exe: apt-cyg!
url: https://github.com/transcode-open/apt-cyg
=================================================
make shell-scripts runnable under Win (7):
add to the first line after “#!/bin/bash”
1 |
(set -o igncr) 2>/dev/null && set -o igncr; |
else you get the error message that “\r” is not a command … ha
=================================================
how to use proxy for firewalled use:
1 |
export http_proxy=http://username:password@host:port/ |
Maybe more will be added. All just small, but fixing tricky
shell-script to clean a project
I like to decorate the code with some debugging-messages, explicit variables, etc. while developing a feature or fixing a bug. Problem is that other team-members will not like that (or the amount ;)).
So, I commit the current state with Git and then remove all lines marked with the comment “// todoM”. Since this some non-creative work, why not automate it?
Code for the bash-script now on github: https://github.com/marcelpetrick/cleanMyCode 🙂
Further improvements like massive parallelization planned!
edith 20170619:
The fourth version relies now on some exported bash-function, so that GNU parallel can be used to speed up the process by parallelizing the search&replace inside the file- (-list given by find).
This helps, just I/O is now the bottleneck. CPU-speed not.
But I’ve always wanted to experiment with “parallel” and see how to use this. I should improve the “contactSheet”-script as well. Or the cat-cam-script .. endless opportunities ..