Skip to content

Instantly share code, notes, and snippets.

mcastelino / .tmux.conf
Last active Aug 8, 2016
tmux configuration with logical key sequences and co-existence with mobaxterm
View .tmux.conf
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind h split-window -h
bind v split-window -v
unbind '"'
unbind %
mcastelino / git_rebase_to_squash
Last active Aug 30, 2016
github code review workflow for branches
View git_rebase_to_squash
Thought I would document something that helps speed up github code review process for people who have lots of PR's in flight that build
on top of each other
My normal workflow involves
1. Branch off of master for PR1 on branch branch_pr1
2. Submit a PR from branch_pr1 (head of this branch is sha_pr1_old)
3. Wait for code review comments ##
4. Continue development for PR2 on branch_pr2 which is off of branch_pr2 (you have branched off at sha_pr1_old)
5. Submit a PR from branch_pr2
6. When you get code review feedback for branch_pr1, incorporate it and squash them back on branch_pr1 (to keep a clean history on github)
mcastelino / fedora_fonts
Created Sep 5, 2016
Fixing fonts on Fedora 24 - Freetype
View fedora_fonts
su -c 'dnf install$(rpm -E %fedora).noarch.rpm$(rpm -E %fedora).noarch.rpm'
sudo dnf install freetype-freeworld
Add them to /etc/fonts/local.conf for system wide use.
mcastelino / .vimrc
Last active Sep 6, 2016
vimrc with YCM and Syntastic Support alongside tagbar and nerdtree git
View .vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
setlocal cinoptions=:0
setlocal spell spelllang=en_us
set nu
set background=dark
colorscheme solarized
mcastelino / building_vim.txt
Created Sep 12, 2016
Building vim from sources for use with vim-go as well a YCM
View building_vim.txt
# Ensure that you install all the dependencies
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
python3-dev ruby-dev lua5.1 lua5.1-dev libluajit-5.1-dev git
# Ensure that you have the right python config directory
pip install python-config
/usr/bin/python2.7-config --configdir
mcastelino / ubuntu cloud image creation
Last active Sep 29, 2016
ubuntu cloud image creation
View ubuntu cloud image creation
How to create a simple cloud image
sudo apt-get install cloud-utils
mv xenial-server-cloudimg-amd64-disk1.img xenial-server-cloudimg-amd64-disk1.img.dist
qemu-img convert -O qcow2 xenial-server-cloudimg-amd64-disk1.img.dist xenial-server-cloudimg-amd64-disk1.img
qemu-img resize xenial-server-cloudimg-amd64-disk1.img +40G
View k8s
$ ssh -f -nNT -L 8080: user@node0 [-p port]
The UI should be available at dashboard/ on the client machine.
View Ciao Single VM IPTables
iptables -I INPUT 1 -p tcp -m tcp --dport 8888 -j ACCEPT
iptables -I INPUT 1 -p 47 -j ACCEPT
iptables -I OUTPUT 1 -p 47 -j ACCEPT
iptables -I INPUT 1 -p tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT 1 -p tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
iptables -I FORWARD 1 -p tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
iptables -I FORWARD 1 -p tcp --sport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
iptables -I FORWARD 1 -p udp -m udp --dport 67:68 -j ACCEPT
iptables -I FORWARD 1 -p udp -m udp --dport 53 -j ACCEPT
iptables -I FORWARD 1 -p udp -m udp --dport 123 -j ACCEPT
mcastelino /
Last active Nov 30, 2016
Docker tips and tricks

Delete dangling volumes

docker volume rm $(docker volume ls -f dangling=true -q)

docker rmi $(docker images -f dangling=true -q)

Get the docker log on a systemd platform

View ttyrecording
ttyrec and ttygif
ttygif: or
% ttyrec
(In the executed shell, do whatever you want and exit)