yet another note for myself

Category Archives: Uncategorized

Dry Run in Shell Scripts

Most shell scripts are like black box; they just do their magic without giving the slightest hint to the user about what just happened. Nevertheless, sometimes it is useful to show the commands that a shell script will execute. In … Continue reading

Dividing data into training and testing dataset in R

During machine learning one often needs to divide the two different data sets, namely training and testing datasets. While you can’t directly use the “sample” command in R, there is a simple workaround for this. Essentially, use the “sample” command … Continue reading

Shell Tips

Array Operations #Append var=( ${array[@]-} $(echo “$variable”) ) #Get Unique elements from any array echo ${oldArray[@]}|awk ‘{for(i=1;i<NF;i++) printf “%s\n”,$i}’ | sort -u #Check if element is present in an array File Operations #list files greater than 10bytes find *.csv.gz -type … Continue reading

Setting Parameters of a Ruby Class through Command Line Arguments

In this post, I want to address two things: How to run a ruby class through command line? This is rather simple and just need few lines (see if __FILE__ = $0 in the code below) How to set configuration … Continue reading