Skip to content

Instantly share code, notes, and snippets.

View ffledgling's full-sized avatar
🏠
🔢

Anhad Jai Singh ffledgling

🏠
🔢
View GitHub Profile
@ffledgling
ffledgling / debug.hpp
Created January 19, 2020 23:10
C++ DEBUG MACROS
#define PRINT_MAP(M) for(auto m: M) cout << m.first << "," << m.second << " "; cout << endl;

Keybase proof

I hereby claim:

  • I am ffledgling on github.
  • I am ffledgling (https://keybase.io/ffledgling) on keybase.
  • I have a public key ASDIDtlKG35WXAbfBJu1XkQ3jOFrflk2RkZleXRSrVMaeQo

To claim this, I am signing this object:

@ffledgling
ffledgling / kube-prompt.sh
Last active February 27, 2019 11:55
Dead simple PS1 prompt add-on for bash to display the current kubernetes namespace and context
#!/bin/bash
# Simple prompt addon to display kubernetes ns and cluster context
# To use, add the following in your .bashrc:
# ```
# source $PATH_TO_FILE/kube-prompt.sh
# KUBE_PROMPT_COLORS=y
# PS1='{$(__kube_ps1)}'$PS1
# ```
@ffledgling
ffledgling / ubuntu-18-docker-install.sh
Created November 23, 2018 17:44
Install Docker on Ubuntu 18.04 (without having to copy paste each step from the docs)
#!/bin/bash
sudo apt update -y
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
@ffledgling
ffledgling / prompt.sh
Last active October 9, 2018 10:49
Custom AWS prompt, configurable with aws instance variables
# Custom prompt for debian/ubuntu AWS instances the default is garbage
# Works best with dark terminals, tested often with solarized dark
# Define colors
black="$(tput setaf 0)"
red="$(tput setaf 1)"
green="$(tput setaf 2)"
yellow="$(tput setaf 3)"
blue="$(tput setaf 4)"
magenta="$(tput setaf 5)"
@ffledgling
ffledgling / root-container.yaml
Created April 20, 2018 12:14
Get a rootcontainer on a kubernetes node. Useful for debugging, when you don't have access to or can't install stuff on the actual node. `kubectl apply -f root-container.yaml` and `kubectl exec -it debug-pod /bin/bash` to execute.
apiVersion: v1
kind: Pod
metadata:
name: debug-pod
spec:
hostNetwork: true
nodeSelector:
kubernetes.io/hostname: kubenode.example.com
containers:
- name: myshell
@ffledgling
ffledgling / echo.yaml
Created April 17, 2018 12:43
Spin up a hello world server in kubernetes
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: echo
spec:
template:
metadata:
labels:
app: echo
spec:
@ffledgling
ffledgling / utils.sh
Last active April 11, 2018 12:25
Useful utility functions for bash
#!/bin/bash
# Can be sourced, or just copy the function you need
# Index
# * openremotefile REMOTE FILENAME
# : Downloads a file from the remote and opens it for viewing on your local machine. Useful when no X/VNC on remote.
openremotefile() {
@ffledgling
ffledgling / Docker.md
Last active March 27, 2018 12:52
Docker Basics Talk

Docker

What is docker?

  • Containerization technology at it's heart
  • Lots of goodies that make containers easy to use as part of the eco-system

What problems does docker solve?

@ffledgling
ffledgling / libvirt-install.md
Created March 4, 2018 20:52
Compile a custom libvirt+libvirt-python+virt-manager stack

Download and install a custom version of libvirt/virsh

CUSTOM_ROOT=/home/ajaisingh/n4/nested-vm/

mkdir -p $CUSTOM_ROOT/src
wget https://libvirt.org/sources/libvirt-4.0.0.tar.xz

# Compiling a new version of libvirt (v4.0.0), requires libnl-devel, libnl-route, libyajl-devel, libdevmapper-devel

sudo apt-get install libnl-route-3-dev