Skip to content

Instantly share code, notes, and snippets.

Avatar

Amit Bakshi ambakshi

View GitHub Profile
View gist:307445
wget http://redis.googlecode.com/files/redis-1.2.2.tar.gz
tar -zxvf redis-1.2.2.tar.gz
cd redis-1.2.2
make && ./redis-server
@ambakshi
ambakshi / make-gcc
Created Jan 20, 2011
Build gcc from source
View make-gcc
#!/bin/sh
GCC_VER=4.5.2
wget -O /tmp/gcc-$GCC_VER.tar.bz2 ftp://ftp.gnu.org/gnu/gcc/gcc-$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
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
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 https://raw.github.com/mxcl/homebrew/go)\" && sudo brew install coreutils\n\n\n" >&2
exit 2
@ambakshi
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
ambakshi / mkdb.sh
Created Jun 6, 2013
Create a new mysql db for the given user/password
View mkdb.sh
#!/bin/bash
if [ $# -lt 3 ]; then
echo >&2 "$0 <db> <user> <pass>"
exit 2
fi
db="$1"
db_user="$2"
db_pass="$3"
mysql <<EOF
CREATE DATABASE \`$db\`;
@ambakshi
ambakshi / vimrc.basic
Last active Jan 6, 2018
Minimal/basic vimrc
View vimrc.basic
"
" Original: https://gist.github.com/ambakshi/9334557/raw/vimrc.basic
" 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
ambakshi / asgard-bootstrap.sh
Last active Aug 29, 2015
Download and run Asgard locally
View asgard-bootstrap.sh
#!/bin/bash
#
# curl -fsSL http://bit.ly/YXV7L3 | bash -e
#
#
set -e
DIR=$HOME/bin
[ -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
ambakshi / ssh-agent.sh
Created Jun 19, 2014
set up ssh agent
View ssh-agent.sh
#!/bin/bash
SSH_ENV="$HOME/.ssh/environment.$HOSTNAME"
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
return