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 / Message Queue - README
Last active February 5, 2016 11:16
Message Queue
1. Fire up the command prompt.
2.1. Execute: gcc send.c -o send
2.2. Execute: gcc recv.c -o recv
3. Execute: ./send <<< "Message."
4. Execute: ./recv
// Source: http://supp.iar.com/FilesPublic/SUPPORT/000419/AN-G-002.pdf
unsigned int sqroot(unsigned int x){
unsigned int a,b;
b = x;
a = x = 0x3f;
x = b/x;
a = x = (x+a)>>1;
x = b/x;
a = x = (x+a)>>1;
1. Fire up the command prompt.
2.1. Execute: gcc shm_server.c -o shm_server
2.2. Execute: gcc shm_client.c -o shm_client
3. Execute: ./shm_server &
4. Execute: ./shm_client
@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
@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 / 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 / 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 / createPYC.sh
Created October 12, 2016 15:09
Generate Python Bytecode
python -m compileall $1
@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 / readHID.sh
Created February 8, 2017 05:33
Retrieve raw HID data
cat /proc/bus/input/devices
sudo cat /dev/input/event7