Skip to content

Instantly share code, notes, and snippets.

View vifm-media-osx.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""vifm mediaprg for Mac OSX"""
from __future__ import print_function
import argparse
import plistlib
import subprocess
import sys
View 001-preload.zsh
# Load plugins and autoloads compinit
#
# Works around issues created by
# https://github.com/robbyrussell/oh-my-zsh/issues/4072
is_plugin() {
local base_dir=$1
local name=$2
test -f $base_dir/plugins/$name/$name.plugin.zsh \
View Modified noplaintext.vim
" Prevent various Vim features from keeping the contents of pass(1) password
" files (or any other purely temporary files) in plaintext on the system.
"
" Modified from:
" Author: Tom Ryder <tom@sanctum.geek.nz>
" From: https://gist.github.com/tejr/5890634
"
" The '/private' part is Mac-specific
let s:passtmp='/private' . expand('$TMPDIR') . "pass.*/*"
View gist:f7e953492ca9f910062f
### Keybase proof
I hereby claim:
* I am von on github.
* I am vwelch (https://keybase.io/vwelch) on keybase.
* I have a public key whose fingerprint is 200A BDDC B3E6 B86E 50C5 F615 93D4 09C8 1BBC 0D27
To claim this, I am signing this object:
View setup-fermi-cloud*
#!/bin/sh
check_root()
{
if [ $UID -ne 0 ]; then
echo "Must be root to run setup-fermi-cloud"
exit 1
fi
}
@von
von / bug-reproduce.sh
Created May 4, 2012
Create a git repo with submodule to reproduce issue byplayer/egg #41
View bug-reproduce.sh
#!/bin/sh
set -x
pwd=`pwd`
mkdir subrepo
cd subrepo
git init
echo Hello World > README
git add README
git commit -m "Initial Commit"
@von
von / encrypted.google.com-may5.pem
Created May 5, 2011
encrypted.google.com certificate on may 5
View encrypted.google.com-may5.pem
-----BEGIN CERTIFICATE-----
MIIE5TCCBE6gAwIBAgIKUCQN3QADAAAmcjANBgkqhkiG9w0BAQUFADBGMQswCQYD
VQQGEwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzEiMCAGA1UEAxMZR29vZ2xlIElu
dGVybmV0IEF1dGhvcml0eTAeFw0xMTA0MTMwOTE2NDVaFw0xMjA0MTMwOTI2NDVa
MGYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1N
b3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgSW5jMRUwEwYDVQQDFAwqLmdv
b2dsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANZ+W4zQYGKC3kXU
Lw9brzZddICikrOUI0KUeoCZEoauBWdbO5ev7JmM44vHVumiI+xsaXhyv0KfGjk0
V0Jk58okbp3oz2WQTm/9n8NMrDzVNc7Dj7dTk6QDIXNXuY5ufPDQc4HgFAz5B6eT
AsNlCorjoNIEJmq43hSV9M8xVCwjAgMBAAGjggK4MIICtDAdBgNVHQ4EFgQUlJdu
@von
von / encrypted.google.com-may4.pem
Created May 5, 2011
encrypted.google.com certificate on may 4
View encrypted.google.com-may4.pem
-----BEGIN CERTIFICATE-----
MIIE5TCCBE6gAwIBAgIKZ+eONAADAAAiYzANBgkqhkiG9w0BAQUFADBGMQswCQYD
VQQGEwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzEiMCAGA1UEAxMZR29vZ2xlIElu
dGVybmV0IEF1dGhvcml0eTAeFw0xMTAyMTYwMDI0NTNaFw0xMjAyMTYwMDM0NTNa
MGYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1N
b3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgSW5jMRUwEwYDVQQDFAwqLmdv
b2dsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOpx2otu08SclYvZ
EWYpUVI+MYANr6cNadHdpUiUsAWayK+Y6DH6B4EvDrGNgQUEA235HVPexdggkaE3
nbdIjys/cwpPQXsYpuJsz/Cn6B4lkC3FsEHRewHvLvGcWYuORPt5AO4x/aR4AYeo
4j/9vje52R4NMFmVjK5x1bMh3FAjAgMBAAGjggK4MIICtDAdBgNVHQ4EFgQUFV05
View gist:949338
$ p2.py -h
usage: p2.py [-h] [-c FILE] [--option1 OPTION1] [--option2 OPTION2]
optional arguments:
-h, --help show this help message and exit
-c FILE, --conf_file FILE
Specify config file
--option1 OPTION1 some option
--option2 OPTION2 some other option
@von
von / p-with-fixed-help.py
Created Apr 30, 2011
Demonstrate parse_known_args() with fixed help
View p-with-fixed-help.py
#!/usr/bin/env python
import argparse
import ConfigParser
conf_parser = argparse.ArgumentParser(
# Turn off help, so we print all options in response to -h
add_help=False
)
conf_parser.add_argument("-c", "--conf_file",
help="Specify config file", metavar="FILE")