Skip to content

Instantly share code, notes, and snippets.

View makokal's full-sized avatar
🤖

Billy makokal

🤖
View GitHub Profile
@makokal
makokal / slist.cpp
Created February 6, 2012 18:24
Simple cycle check in singly linked list (was part of SDE code interview)
/**
* Simple Singly Linked List
* Demonstrating check for cycles by remembering all visited nodes
*
* Using BOOST::Unordered_map as a hash table implementation
*
* \author Billy Okal
*/
@makokal
makokal / rhtml_clean
Created February 13, 2012 18:32
Rename all .rhtml file in a folder to .html.erb or any other format
for i in ./*rhtml*;do mv -- "$i" "${i//rhtml/html.erb}";done
@makokal
makokal / erb_2_haml.sh
Created March 15, 2012 02:01
script to convert erb to HAML for a whole project
#!/bin/bash
for i in `find . -name '*.erb'` ; do
html2haml $i `echo $i | sed 's/\.erb/\.haml/'`
done
find . -name '*.erb' -exec rm \{\} \;
@makokal
makokal / januspimp.sh
Created August 8, 2012 21:31
additional vim plugins on top of janus setup
!#/bin/sh
mkdir ~/.janus
cd ~/.janus
git clone https://github.com/jimenezrick/vimerl.git
git clone https://github.com/Lokaltog/vim-powerline.git
git clone https://github.com/myusuf3/numbers.vim.git
git clone git://github.com/altercation/vim-colors-solarized.git
git clone https://github.com/tomasr/molokai.git
@makokal
makokal / zip_changed.sh
Created September 16, 2012 19:33
Zip all local modification in a svn repo
#!/bin/sh -e
if [ $# -ne 2 ]; then
echo usage: $0 working_copy_path zip_file_path
exit 1
fi
cd $1 && svn status | grep ^[AM] | awk '{print $2}' | zip $2 -@
echo "Done"
@makokal
makokal / gist:4635508
Created January 25, 2013 15:57
Batch rename a number of files appending 0s before extension to preserve alphabetical ordering e.g. after collecting images from camera to make a video with mencoder
# EXT is the extension of the files
rename 's/(\d+)\.EXT/sprintf("%03d.EXT", $1)/e' *.EXT
@makokal
makokal / gist:4635535
Created January 25, 2013 16:00
Make a video from images using mencoder
mencoder "mf://*.png" -mf fps=20 -o video_name.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=800
@makokal
makokal / count_svn
Created May 15, 2013 16:48
count svn commits per user
svn log -v --xml | grep '<author.*/author>' | sort $* | uniq -c | sort -rn
#!/usr/bin/perl -w
use strict;
my @rmdirs = ('.svn');
my @rmfiles = ();
sub filelist
{
my ($dir, $regex) = @_;
opendir(DIR, $dir) || return ();
@makokal
makokal / stage_install_mac.sh
Created August 19, 2013 19:03
Installing stage 2D robot simulator on a mac (with homebrew already setup)
#install dependencies
brew install fltk cmake git pkg-config
# setup an install location e.g in home
mkdir $HOME/stg
# clone and compile stage
mkdir stage && cd stage
git clone git://github.com/rtv/Stage.git
export STG=$HOME/stg