Skip to content

Instantly share code, notes, and snippets.


Amit Bakshi ambakshi

View GitHub Profile
View gist:307445
tar -zxvf redis-1.2.2.tar.gz
cd redis-1.2.2
make && ./redis-server
ambakshi / make-gcc
Created Jan 20, 2011
Build gcc from source
View make-gcc
wget -O /tmp/gcc-$GCC_VER.tar.bz2$GCC_VER/gcc-$GCC_VER.tar.bz2
tar jxvf /tmp/gcc-$GCC_VER.tar.bz2
cd gcc-$GCC_VER
mkdir -p $HOME/opt/gcc/gcc-$GCC_VER
./configure --prefix=$HOME/opt/gcc/gcc-$GCC_VER --with-mpc
CPUCOUNT=`grep processor /proc/cpuinfo | wc -l`
make -j$CPUCOUNT
ambakshi / main.cpp
Created Apr 18, 2011
Explicit initialization and dependencies of subsystems.
View main.cpp
int main(int argc, const char** argv) {
int flags = FlagsFromArgs(argc, argv);
Memory* memory = MemoryNew( MEMORY_HEAP_256MB | MEMORY_HEAP_DEBUG | flags );
Sound* sound = SoundNew( memory, SOUNDMGR_ALL_CHANELS | flags );
Renderer* renderer = RendererNew( memory, RENDERER_TRIPLE_BUFFER | RENDERER_SM_20 | flags );
Physics* phys = PhysicsNew( memory, sound, PHYSICS_AWESOME_FLAG | flags);
// .. etc ..
Game* game = GameNew( memory, sound, physics, ... , GAME_AAA_MODE | flags );
ambakshi / setup_coreutils.bash
Last active Dec 17, 2015
Create bash functions to call GNU coreutils version of UNIX tools on OSX.
View setup_coreutils.bash
# On OSX, some utilities (tar, sed, etc) are totally outdated. You can
# brew install coreutils to get around this, but the tools are named gsed,
# gtar, etc.
setup_coreutils () {
if [ "`uname -o`" == "Darwin" ]; then
PATH="/usr/local/bin:$PATH" && hash -r
if [ ! -e /usr/local/bin/gln ]; then
printf "On OSX you need GNU coreutils. Please install brew and coreutils.\n\n"
printf " ruby -e \"\$(curl -fsSL\" && sudo brew install coreutils\n\n\n" >&2
exit 2
ambakshi / vimrc
Last active Dec 17, 2015
Basic vimrc
View vimrc
set nocompatible
filetype plugin indent on
" set t_Co=256
set t_Co=8
syntax on
set bs=indent,eol,start
set ts=4 sts=4 expandtab shiftround smarttab shiftwidth=4
set hlsearch showmatch ignorecase incsearch smartcase
set noerrorbells
set showcmd title cmdheight=2
ambakshi /
Created Jun 6, 2013
Create a new mysql db for the given user/password
if [ $# -lt 3 ]; then
echo >&2 "$0 <db> <user> <pass>"
exit 2
mysql <<EOF
ambakshi / vimrc.basic
Last active Jan 6, 2018
Minimal/basic vimrc
View vimrc.basic
" Original:
" By Amit Bakshi
set nocompatible
filetype plugin indent on
set modeline
set incsearch hlsearch ignorecase smartcase
set expandtab smarttab shiftwidth=4 shiftround softtabstop=4 tabstop=4
set smartindent autoindent copyindent cindent
ambakshi /
Last active Aug 29, 2015
Download and run Asgard locally
# curl -fsSL | bash -e
set -e
[ -d "$DIR" ] || mkdir -p "$DIR"
View screenrc
# screenrc
encoding UTF-8
# Behaviour
termcapinfo xterm ti@:te@
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' # Tell screen how to set colors. AB = background, AF=foreground
#attrcolor b ".I" # Allow bold colors - NB: This fucks up dircolors in iTerm2
defbce "on" # Erase background with current bg color
altscreen on
#term xterm-256color
ambakshi /
Created Jun 19, 2014
set up ssh agent
start () {
if [ -f "$SSH_ENV" ]; then
source "$SSH_ENV"
if kill -0 "$SSH_AGENT_PID" 2>/dev/null; then
echo "Run 'source $SSH_ENV'" >&2