Skip to content

Instantly share code, notes, and snippets.

@shiva
shiva / file-removal-from-git.md
Last active March 14, 2024 02:53
Remove files permanently from git
@shiva
shiva / FindNim.cmake
Created October 21, 2014 12:47
cmake module for running nimrod compiler
include(CMakeParseArguments)
find_program(NIM_EXECUTABLE nimrod PATHS ENV PATH)
mark_as_advanced(NIM_EXECUTABLE)
# Determine the valac version
if(NIM_EXECUTABLE)
execute_process(COMMAND ${NIM_EXECUTABLE} "--version"
OUTPUT_VARIABLE NIM_VERSION
@shiva
shiva / git-config-alias.txt
Last active July 27, 2018 22:02
Commonly used aliases for git
# git config --global -e
Then copy the following into the global git config
[alias]
lg = log --color --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --no-merges
st = status
c = commit
b = branch
co = checkout
@shiva
shiva / Makefile
Last active April 6, 2018 05:34 — forked from wolfeidau/Makefile
Standard NodeJS make file.
REPORTER = spec
.PHONY: test tap unit jshint skel help
all: jshint test ## Run all targets
test: ## Run tests
@NODE_ENV=test ./node_modules/.bin/mocha --recursive --reporter $(REPORTER) --timeout 3000
jshint: ## Run Static Analysis

Keybase proof

I hereby claim:

  • I am shiva on github.
  • I am shivanand (https://keybase.io/shivanand) on keybase.
  • I have a public key ASBoHW8IILoVb7W-xD4LBj60cDtga-A8P0v6bErCa_gIWQo

To claim this, I am signing this object:

@shiva
shiva / pre-commit-clang-format
Last active July 7, 2017 16:24 — forked from wangkuiyi/pre-commit-clang-format
Git pre-commit hook that invokes clang-format to reformat C/C++/Objective-C source code.
#!/bin/bash
# git pre-commit hook that runs an clang-format stylecheck.
# Features:
# - abort commit when commit does not comply with the style guidelines
# - create a patch of the proposed style changes
# modifications for clang-format by rene.milk@wwu.de
# This file is part of a set of unofficial pre-commit hooks available
# at github.
@shiva
shiva / sample.haml
Created May 21, 2012 06:10
HTML vs HAML - HTML sample
I
%a{ :href => "http://twitter.com/shiva" } tweet
,
%a{ :href => "http://shiva.tumblr.com/" } tumble
,
%a{ :href => "http://facebook.com/shivanand" } facebook
\. Am I allowed to use that as a verb?! Who cares, to hell with correctness!
Ohh. I also
%a{ :href => "/blog" } blog in long form
\. Recently, I've started a project called
@shiva
shiva / whitespace-aliases.sh
Last active December 30, 2016 06:06
Remove trailing whitespaces in all of the files modified in the last git commit
alias remove-whitespace='sed -e '\''s/[[:blank:]]\+$//'\'' -i'
alias remove-ws-in-last-commit= 'for f in `git show --name-only --pretty=""`; do echo $f; remove-whitespace $f; done'
@shiva
shiva / aliases-for-dev.sh
Last active December 30, 2016 06:05
Useful Aliases
alias gen-cscope='find . -iname '\''*.c'\'' -o -iname '\''*.cpp'\'' -o -iname '\''*.cc'\'' -o -iname '\''*.h'\'' -o -iname '\''*.hpp'\'' > cscope.files && cscope -b -i cscope.files -f cscope.out'
alias gen-tags='ctags -R --c++-kinds=+p --fields=+iaS --extra=+q'
@shiva
shiva / rfind-git-status.sh
Last active December 29, 2016 21:30
List the status of all the git repos found at any depth in the current repo
$ for d in `find . -name ".git"`; do \
echo "processing $d ..."; \
git --git-dir=$d --work-tree=$d/.. status; \
done