Skip to content

Instantly share code, notes, and snippets.

View pprince's full-sized avatar

Paul Prince pprince

View GitHub Profile
input_module=xim
export GTK_IM_MODULE=$input_module
export XMODIFIERS=@im=$input_module
export QT_IM_MODULE=$input_module
{% set our_ips = [] %}
{% our_ips.extend(salt['network.ip_addrs'](cidr="10.150.0.0/16")) %}
{% our_ips.extend(salt['network.ip_addrs'](cidr="172.16.0.0/16")) %}
{% set our_ip = (our_ips + [None])[0] %}
@pprince
pprince / .zshrc
Created May 16, 2016 03:48
teatime's zshrc
# ~/.zshrc
# ========
# This file is sourced only for interactive shells. It
# should contain commands to set up aliases, functions,
# options, key bindings, etc.
#
# Global Order: zshenv, zprofile, zshrc, zlogin
{% set home_dir = pillar['general']['my_home_dir'] %}
add-local-search-path:
file.replace:
- name: {{ home_dir }}/.bash_profile
- pattern: "^PATH=\\$PATH"
- repl: "PATH=$PATH:$HOME/usr/bin"
- unless: grep "\$HOME/usr/bin" {{ home_dir }}/.bash_profile
sysctl:
pkg: procps-ng
config:
dir: '/etc/sysctl.d'
file: '/etc/sysctl.conf'
params:
- foo.bar: 30
- abc.def: xyz
- fs.file-max:
value: 100000
URxvt.font: \
xft:PragmataPro:style=Regular:pixelsize=16:minspace=true:antialias=true:rgba=rgb:lcdfilter=lcddefault:hinting=true:autohint=false:hintstyle=hintfull:embeddedbitmap=true
URxvt.boldFont: \
xft:PragmataPro:style=Bold:pixelsize=16:minspace=true:antialias=true:rgba=rgb:lcdfilter=lcddefault:hinting=true:autohint=false:hintstyle=hintfull:embeddedbitmap=true, \
xft:PragmataPro:style=Regular:pixelsize=16:minspace=true:antialias=true:rgba=rgb:lcdfilter=lcddefault:hinting=true:autohint=false:hintstyle=hintfull:embeddedbitmap=true
URxvt.italicFont: \
xft:PragmataPro:style=Italic:pixelsize=16:minspace=true:antialias=true:rgba=rgb:lcdfilter=lcddefault:hinting=true:autohint=false:hintstyle=hintfull:embeddedbitmap=true, \
xft:PragmataPro:style=Regular:pixelsize=16:minspace=true:antialias=true:rgba=rgb:lcdfilter=lcddefault:hinting=true:autohint=false:hintstyle=hintfull:embeddedbitmap=true
URxvt.boldItalicFont: \
xft:PragmataPro:style=Bold Italic:pixelsize=16:minspace=true:antialias=true:r
#!/usr/bin/env sh
t=urxvtcd
if [ $# -eq 1 ]; then
"$t" -e "$1"
else
"$t" "$@"
fi
@pprince
pprince / postactivate.sh
Last active March 28, 2016 18:19
virtualenvwrapper hooks to cleanly set/restore some variables when activating/deactivating a venv
#!/bin/sh
# This hook is sourced after every virtualenv is activated.
__vew_is_in_env () {
awk 'BEGIN { exit ! ("'"$1"'" in ENVIRON) }'
}
__vew_set_and_preserve () {
if __vew_is_in_env "$1" && ! __vew_is_in_env "__VEW_OLD_$1"; then
eval "__VEW_OLD_$1=\$$1"
Going to run: find /usr -name "*c*" -type f -exec cat {} \; | wc -l
0.23s user 0.91s system 17% cpu 6.468 total
0.34s user 0.87s system 18% cpu 6.659 total
0.27s user 0.87s system 17% cpu 6.527 total
0.31s user 0.89s system 17% cpu 6.777 total
0.29s user 0.96s system 17% cpu 6.928 total
Going to run: find /usr -name "*c*" -type f -exec cat {} + | wc -l
0.14s user 0.32s system 95% cpu 0.484 total
@pprince
pprince / perf.sh
Created March 28, 2016 12:49 — forked from anonymous/perf.sh
#!/usr/bin/zsh
SHELL=/usr/bin/zsh
do_perf () {
printf "Going to run: %s\n" "$1"
for i in {1..5}; do
time $SHELL -c "$1"
done