Skip to content

Instantly share code, notes, and snippets.

View rubic's full-sized avatar

Jeff Bauer rubic

  • Rubicon, Inc.
  • Nashville, Tennessee
View GitHub Profile
@rubic
rubic / gist:1657182
Created January 22, 2012 14:11
Installing salt with apt-get and pip
apt-get -y install python-pip python-dev python-setuptools git-core
apt-get -y install libzmq1 libzmq-dev python-m2crypto
pip install PyYAML pycrypto pyzmq msgpack-python salt
@rubic
rubic / gist:1b6cac21460f47f6e3e1574a5cc58254
Created February 28, 2019 21:57
Using xev for checking keyboard values
xev -event keyboard | egrep -o 'keycode.*\)'
@rubic
rubic / gist:1644599
Created January 20, 2012 02:33
setuid via subprocess.Popen
#!/usr/bin/env python
import os, subprocess
uid, gid = 5, 60
def preexec_fn():
os.setgid(uid)
os.setuid(gid)
cmd = ['uname', '-a']
@rubic
rubic / .bashrc
Created February 24, 2017 20:23
Load salsa docker commands in bashrc
# Load salsa docker commands
if [ -f ~/Projects/gringo/bin/salsa_aliases.sh ]; then
source ~/Projects/gringo/bin/salsa_aliases.sh
fi
@rubic
rubic / init.el
Created September 24, 2015 13:39
faux hybrid mode
(define-key evil-normal-state-map "\C-e" 'evil-end-of-line)
(define-key evil-motion-state-map "\C-e" 'evil-end-of-line)
(define-key evil-insert-state-map "\C-e" 'end-of-line)
(define-key evil-normal-state-map "\C-n" 'evil-next-line)
(define-key evil-insert-state-map "\C-n" 'evil-next-line)
(define-key evil-visual-state-map "\C-n" 'evil-next-line)
(define-key evil-normal-state-map "\C-p" 'evil-previous-line)
(define-key evil-insert-state-map "\C-p" 'evil-previous-line)
(define-key evil-visual-state-map "\C-p" 'evil-previous-line)
(define-key evil-normal-state-map "\C-y" 'yank)
@rubic
rubic / spacemacs-cheatsheet.md
Created July 8, 2016 14:33
Spacemacs cheatsheet

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

M-m and SPC can be used interchangeably.

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
@rubic
rubic / gitcheck.sh
Created March 16, 2016 13:41
gitcheck: check status between local and remote repositories
#!/bin/sh
git fetch
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u})
BASE=$(git merge-base @ @{u})
if [ $LOCAL = $REMOTE ]; then
echo "Up-to-date"
(setq inhibit-startup-message t) ; disables splash screen
(setq initial-scratch-message nil) ; suppress initial *scratch* buffer msg
(setq transient-mark-mode t) ; highlights the selected region
(tool-bar-mode -1) ; remove the toolbar
(setq default-major-mode 'text-mode) ; make text-mode default
(setq-default fill-column 66) ; set the fill column for word wrap
(setq-default indent-tabs-mode nil) ; spaces instead of tabs by default
(mouse-wheel-mode t) ; enable mouse wheel
(setq scroll-step 1) ; scroll up by a single line
(add-to-list 'load-path "~/.emacs.d") ; load path
@rubic
rubic / gist:1657678
Created January 22, 2012 17:00
Portable method to install Java on Ubuntu cloud images
cloud-init: ##############################################################
#cloud-config
apt_upgrade: true
apt_sources:
- source: "ppa:sun-java-community-team/sun-java6"
user-script: #############################################################
#!/bin/sh
@rubic
rubic / ec2connection.py
Created January 21, 2012 17:44
Magic for working with EC2 instances interactively with IPython
# Magic imports for working interactively (ipython)
# ipython -i ec2connection.py
import re
import boto.ec2
RegionRegex = re.compile("^us-") # all regions starting with 'us-'
class EC2(object):
def __init__(self):