Skip to content

Instantly share code, notes, and snippets.


Amit Bakshi ambakshi

View GitHub Profile
ambakshi / gitconfig
Last active January 23, 2023 18:10
my gitconfig
View gitconfig
; vim:set filetype=dosini:
fap = fetch --all --prune
sb = status -sb
st = status -s
co = checkout
br = branch
bv = branch -avv
rv = remote -v
ambakshi / bash_aliases
Last active January 5, 2023 20:59
Bootstrap vim and tmux
View bash_aliases
# shellcheck disable=SC1073,SC1007,SC1072,SC1090,SC1091,SC2015
if [[ $UID -ne 0 ]]; then
if ! type -t __git_ps1 >/dev/null 2>&1 && test -e /usr/share/git-core/contrib/completion/; then
. /usr/share/git-core/contrib/completion/
if type -t __git_ps1 >/dev/null 2>&1; then
PS1='[\[\033[32m\]\u@\h\[\033[00m\] \[\033[36m\]\W\[\033[31m\]$(__git_ps1)\[\033[00m\]] \$ '
ambakshi / Autounattend.xml
Last active December 21, 2022 23:54
Diskpart script to create uefi partitions. Via
View Autounattend.xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="" xmlns:xsi="">
ambakshi / fork.cpp
Last active October 30, 2022 06:21
View fork.cpp
//This is all pretty much from the ReactOS project...
#pragma once
#define _WIN32_WINNT 0x0502 // Change this to the appropriate value to target other versions of Windows.
#define DPRINT(...)
#define DPRINT1(...)
#include <stdlib.h>
#include <tchar.h>
ambakshi / make-gcc
Created January 20, 2011 06:52
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
# Create a variable `$key` for use in powershell as a AES encyrption key
# constant with (ConvertFrom-SecureString)[]
# param: $1 secret key (optional, default: secret)
# param: $2 cipher (optional, default: aes-256-cbc)
# output: An byte array (in decimals), the size of the encryption key (AES256 = 32 bytes)
genkey() {
ambakshi /
Created April 1, 2016 11:57
Install g++ 5.x on Ubuntu Trusty (14.04)
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y g++-5 gcc-5
ambakshi /
Last active October 25, 2021 15:50
Assume an IAM role. An interesting way of doing IAM roles is to give the instance permissions to assume another role, but no actual permissions by default. I got this idea while setting up security monkey:
# Assume the given role, and print out a set of environment variables
# for use with aws cli.
# To use:
# $ eval $(./
ambakshi /
Last active July 25, 2021 05:39
Add all instances in an autoscaling group to an equivalently named dns entry.
# Get all IPs from an autoscale group and update set the local ip as
# equal weight A entries (round robin dns). Takes autoscale group as
# parameter.
# Amit Bakshi
# 10/21/2014
ambakshi /
Last active January 14, 2021 13:15
set -e
## striping seems to break docker
#STRIPE="-i2 -I64"
#DEVS="/dev/xvdf /dev/xvdg"
if [ -z "$DEVS" ]; then
echo >&2 "Specify which block devices to use"
exit 1