Skip to content

Instantly share code, notes, and snippets.

@tomprats
tomprats / after_cd_todo
Created May 12, 2017 22:54
RVM hook for printing out TODOs when switching to a directory
#!/usr/bin/env bash
for file in ./TODO*; do
if [ -f $file ]; then
name=$(basename $file)
echo "######################### $name "#########################
cat $file
echo "######################### $name "#########################
fi
done
@tomprats
tomprats / csv_splitter.rb
Last active September 25, 2015 02:22
Split a large CSV into smaller CSVs specifying the max rows per file
require "csv"
def split_csv(file, max)
csv = CSV.read(file, headers: true)
csv_headers = csv.headers
total_files = ((csv.length - 1)/max.to_f).ceil
max = max.to_i
csv = csv.to_a
name = file.split(".csv")[0]
path = "./csv/"