Skip to content

Instantly share code, notes, and snippets.

View anirudh-ramesh's full-sized avatar
🏁
pongal-o-pongal

Anirudh Ramesh anirudh-ramesh

🏁
pongal-o-pongal
View GitHub Profile
@anirudh-ramesh
anirudh-ramesh / trashcan.log
Created October 28, 2017 19:08
Writers' Tips
The first draft is for the writer. The second draft is for the editor. The last draft is for the reader.
Emphasize how much work you have ahead of you to make this a good book.
Only a good writer would be able to say that.
If you would only defer to the narrative, you could get away with murder.
Most mysterious of all is the hidden middle stage, the offstage act of editing.
The first draft is for the writer. The second draft is for the editor. The last draft is for the reader.
@anirudh-ramesh
anirudh-ramesh / select.sh
Created March 18, 2017 14:58 — forked from vikjam/select.sh
Use awk to subset a CSV
# http://stackoverflow.com/questions/6491532/how-to-subset-a-file-select-a-numbers-of-rows-or-columns
cat largefile | awk 'NR >= 10000 && NR <= 100000 { print }'
#!/bin/bash
# This scripts pops up a notification in X if your RAM is occupied more
# than a certain value (default: 90%).
# Memory is checked every 30 seconds.
checkmemory () {
while
sleep 30
FREE=`free -tw | grep Mem | tr -s ' ' | cut -d ' ' -f 4`
USED=`free -tw | grep Mem | tr -s ' ' | cut -d ' ' -f 3`
@anirudh-ramesh
anirudh-ramesh / readHID.sh
Created February 8, 2017 05:33
Retrieve raw HID data
cat /proc/bus/input/devices
sudo cat /dev/input/event7
@anirudh-ramesh
anirudh-ramesh / iterateTestPattern.sh
Last active February 8, 2017 05:30
Circle around test patterns [#TonboImaging]
INDEX=0
while [[ 1 ]]; do
echo $INDEX
if [[ "$INDEX" == "3" ]]; then
INDEX=0
else
let INDEX="$INDEX + 1"
fi
/opt/ipnc/renderImage /mnt/mmc/$INDEX.png
sleep 10s
@anirudh-ramesh
anirudh-ramesh / createPYC.sh
Created October 12, 2016 15:09
Generate Python Bytecode
python -m compileall $1
@anirudh-ramesh
anirudh-ramesh / align.cpp
Created October 6, 2016 10:02
Align positive number to nearest multiples of another
#include <iostream>
using namespace std;
#define alignUp(value, factor) (((value + (factor - 1)) / factor) * factor)
#define alignDown(value, factor) ((value / factor) * factor)
int main(int c, char **v)
{
@anirudh-ramesh
anirudh-ramesh / GitMeldWrapper.py
Last active December 5, 2016 09:52
Git Diff using Meld
#!/usr/bin/python
import sys
import os
os.system('meld "%s" "%s"' % (sys.argv[2], sys.argv[5]))
@anirudh-ramesh
anirudh-ramesh / renameBranch.sh
Last active June 23, 2016 11:40 — forked from lttlrck/gist:9628955
Renames local as well as remote Git branches.
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@anirudh-ramesh
anirudh-ramesh / Git Clone
Created May 25, 2016 06:20
Clones all branches from a git remote
# git clone <>
# cd <>
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all