Skip to content

Instantly share code, notes, and snippets.

ChinmayVS TheCodeArtist

View GitHub Profile
@TheCodeArtist
TheCodeArtist / estimate-porting-effort-using-commits.sh
Last active Nov 2, 2015
Couple of git and bash commands to generate list of commits (patches) and sort them by size to begin effort estimation.
View estimate-porting-effort-using-commits.sh
# Generate alist of patches from a "base" commit-hash in the past to the HEAD.
# Run this on the source repository
git format-patch --root <commit-hash> <optional-sub-dir> -o patches-from-commit-hash-to-HEAD/
# Generate a sorted (by LoC) list of patch files generate above to focus n the largests changes first.
# NOTE: Sometime, several "small" changes may introduce "dependencies" required by a large change down the line.
# Use "git blame -wCCC", "git log -S <string>" and "git gui blame" for code archaeology.
find ./patches-from-commit-hash-to-HEAD/ -type f -exec wc -l {} + | sort -rn | wc -l > 0000-list-of-commits-sorted-by-lines.txt
@TheCodeArtist
TheCodeArtist / Arduino-UNO-bitmap-triangles-I2C-OLED-display-demo
Last active Aug 29, 2015
Bitmap and Triangles demo on 0.96" I2C 128x64 OLED display connected to Arduino UNO
View Arduino-UNO-bitmap-triangles-I2C-OLED-display-demo
/*
* Bitmap and Shatterring-glass demo on 0.96" I2C 128x64 OLED display connected to Arduino UNO
*
* Demo Video: https://youtu.be/El5VYXpw27I
*
* Author: TheCodeartist (cvs268@gmail.com) 2015
* Licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
* http://creativecommons.org/licenses/by-sa/4.0/
*
*
@TheCodeArtist
TheCodeArtist / git-prevision
Created Apr 30, 2015
git checkout a previous revision of a specific file
View git-prevision
Start by adding the following alias to your gitconfig.
[alias]
prevision = "!f() { git checkout `git log --oneline $2 | awk -v commit="$1" 'FNR == -commit+1 {print $1}'` $2;} ;f"
Usage:
$ git prevision <N> <filename>
will checkout the <N>th revision from the history of the file <filename>.
For example to checkout the immediate previous version of a file x/y/z.c use
@TheCodeArtist
TheCodeArtist / git-prevision
Last active Jul 18, 2018
git checkout a previous revision of a specific file
View git-prevision
Start by adding the following alias to your gitconfig.
[alias]
prevision = "!f() { git checkout `git log --oneline $2 | awk -v commit="$1" 'FNR == -commit+1 {print $1}'` $2;} ;f"
Usage:
$ git prevision <N> <filename>
will checkout the <N>th revision (counting backwards from HEAD) into the history of the file <filename>.
For example to checkout the immediate previous version of a file x/y/z.c use
@TheCodeArtist
TheCodeArtist / atomic-test.c
Created Jul 25, 2013
Define and test custom atomic structure and functions in the absence of gcc intrinsics. atomic_t, atomic_set(), atomic_read(), atomic_inc().
View atomic-test.c
/* atomic-test.c
*
* Compiled using "gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
* Compiler cmd : `gcc atomic-test.c -lpthread -o atomic-test`
*
* objdump -S shows that the lock prefix in properly inserted
*
* 08048674 <atomic_inc>:
* 8048674: 55 push %ebp
* 8048675: 89 e5 mov %esp,%ebp
@TheCodeArtist
TheCodeArtist / 0001-Add-mmap-ed-file-support-to-inotify.patch
Created Jun 27, 2013
This patch adds a new flag IN_SYNC - a new inotify event that is triggered whenever msync() is carried out on a mmap-ed file. Patch is tested on v2.6.37 of the Linux Kernel.
View 0001-Add-mmap-ed-file-support-to-inotify.patch
From 83edf446e92c86c738337ca4a35eab48e2f4e0eb Mon Sep 17 00:00:00 2001
From: Chinmay V S <cvs268@gmail.com>
Date: Mon, 17 Jun 2013 13:53:57 +0800
Subject: [PATCH] Add mmap-ed file support to inotify
This patch adds a new flag IN_SYNC. This is a new inotify event that is
triggered whenever msync() is carried out on a mmap-ed file.
Signed-off-by: Chinmay V S <cvs268@gmail.com>
---
You can’t perform that action at this time.