Skip to content

Instantly share code, notes, and snippets.

Jeremiah Roth rothwerx

Block or report user

Report or block rothwerx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am rothwerx on github.
  • I am rothwerx ( on keybase.
  • I have a public key ASBy7WRKEIU2UJRhUTIcRrHbXliZjB8p5pDriDHcUa6mywo

To claim this, I am signing this object:

rothwerx / gist:5809932
Created Jun 18, 2013
Python: Query given WMI class on Windows host from Linux and output to easy-to-read JSON
View gist:5809932
#!/usr/bin/env python
from optparse import OptionParser
from subprocess import Popen, PIPE
# Requires wmic from Samba project, or here:
wmic = '/vagrant/wmic'
parser = OptionParser()
View gist:d206b61f91526742e5e7
set nocompatible
if has("syntax")
syntax on
if has("autocmd")
" Automatically reload vimrc after saving
autocmd bufwritepost .vimrc source $MYVIMRC
" Remember last position in file
View gist:5c626130fcbe4dea2cb0df6c90dcde86
# set -g default-terminal "screen-256color"
# fix pbpaste and pbcopy commands on OSX
# set-option -g default-command "reattach-to-user-namespace -l $SHELL"
# Report support for 256 colors
set -g default-terminal "screen-256color"
# remap prefix to C-a
set -g prefix C-a
rothwerx / gist:ebef10660b42ae4e3235f47b0236b518
Created Dec 4, 2017
Shell: Installing iPython in Python 2.7
View gist:ebef10660b42ae4e3235f47b0236b518
# iPython 6 dropped support for Python 2.7
sudo pip install "pathlib2==2.1.0"
sudo pip install "ipython<6.0"
rothwerx /
Last active Nov 20, 2017
Bash: Graphite for Raspbian
# A lighter graphite for raspberry pi/raspbian wheezy.
# For when you don't need memcache/rabbitmq/full uWSGI server/etc
# Not fully tested on a clean install. This is just what it *should* take.
# Installing supervisor because upstart conflicts with sysvinit
aptitude update && aptitude install gcc python-dev python-pip python-cairo python-pysqlite2 supervisor libffi-dev
pip install django==1.4.3
rothwerx / gist:96d71d9abedab96f7033c674b1b8e876
Last active Jul 14, 2016
Python: Get time delta from log with YYYY-MM-DD hh:mm:ss format
View gist:96d71d9abedab96f7033c674b1b8e876
#!/usr/bin/env python
import sys
from datetime import datetime
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('logfile', help='Log file')
parser.add_argument('-s', '--seconds', default=1, type=int,
help='Only log entries that took over n seconds')
View gist:4bfc8ce77c23e788d4a0
# This file can be wget'ed at
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
if ! command -v git; then
echo "You really need git."
exit 1
rothwerx / gist:7146476
Created Oct 24, 2013
Go: Small example of running system commands
View gist:7146476
package main
import "os/exec"
import "fmt"
import "bytes"
func main() {
cmd := exec.Command("/bin/ls", "-al")
var out bytes.Buffer
cmd.Stdout = &out
rothwerx / gist:6574543
Last active Dec 23, 2015
Bash: Animated dance. Useful for your celebrating when your multi-pipe one-liner works on the first try.
View gist:6574543
function _totheleft() {
echo "(°_°)"
echo "<) )╯"
echo ' / \'
function _totheright() {
echo " (°_°)"
echo "\( (>"
echo ' / \'
You can’t perform that action at this time.