It is common to assume in the programming world that any competent programmer should be able to learn a new programming language in a few days and be productive within a week or so. Many will brag about their knowledge of multiple languages and how they did this in that and that in this.
The whole concept of a full-stack developer speaks to this same idea. These roles require people to know everything from the front-end (JavaScript, CSS, a framework, etc) to the middle-ware (Python, JavaScript, a framework, etc) to the database (SQL).
I've found this myself. In fact, my last project required me to move between Bash, Java, Python and Clojure daily and sometimes throughout the day.
I wonder though if some sort of specialization might be better. In my last project I wished to focus exclusively on Clojure but that didn't work out.
Continue reading →To show the headers for each csv file in a directory.
#!/bin/bash
# Echo the header lines for all the cvs files in the current directory
for filename in *.csv;
do
# echo $filename;
line=$(head -n 1 $filename);
echo $line;
done
When writing bash scripts that look for environment variables it is a good idea to check that these environment variables exist at the top of the script. For this you do things like the following.
if [[ -z $LOG ]]; then
echo "Missing LOG environment variable"
fi
Now once you've created your environment variable how can you test your script for the case where the environment variable doesn't exist? For this you can open another bash shell with no environment variables. An empty environment if you will. To do this try the following.
$ env -i bash --norc --noprofile
Continue reading →
Ran out of space on the MacBook and found this free Mac cleaner application that worked well.
AppCleaner from FreeMacSoft
Works well.
Continue reading →On a Mac here is an easy method to get Python 3 installed.
$ brew install python3
After this step you'll have your original Python 2.7 version as python and your new Python 3 version as python3.