Skip to content

Instantly share code, notes, and snippets.

@thorrr
thorrr / disable-luks.sh
Last active Oct 5, 2017
Disable password on encrypted LUKS drive
View disable-luks.sh
#!/bin/bash
set -euf -o pipefail
##################
# User variables
#################
KEY_SLOT=5
DEVICE=/dev/sda5
PASSWORD=password
View keybase.md

Keybase proof

I hereby claim:

  • I am thorrr on github.
  • I am jbell9999 (https://keybase.io/jbell9999) on keybase.
  • I have a public key ASCyPG0oZfvP43B3Yzm748xLGNpEMjQLYOz12SfKNvwweQo

To claim this, I am signing this object:

@thorrr
thorrr / five_minutes.yml
Created Jan 16, 2017 — forked from ryane/five_minutes.yml
five_minutes.yml
View five_minutes.yml
---
- hosts: all
vars:
UBUNTU_COMMON_ROOT_PASSWORD: 'xxxxx'
UBUNTU_COMMON_DEPLOY_PASSWORD: 'xxxxx'
UBUNTU_COMMON_LOGWATCH_EMAIL: user@example.com
ubuntu_common_deploy_user_name: deploy
ubuntu_common_deploy_public_keys:
- ~/.ssh/id_rsa.pub
View pyconfig-fix.sh
#!/bin/sh
filename=/usr/include/python2.7/pyconfig.h
patchfile=$(mktemp)
cat << 'EOF' > "$patchfile"
--- pyconfig.h 2016-11-20 09:38:22.434174700 -0500
+++ pyconfig-bsd-not-visible.h 2016-11-20 09:38:05.391993200 -0500
@@ -1218,7 +1218,7 @@
@thorrr
thorrr / install-ipython-notebook-for-cygwin.sh
Last active Jan 4, 2017
install ipython notebook under cygwin
View install-ipython-notebook-for-cygwin.sh
#!/bin/bash
set -e
LIBSODIUM_URL=https://github.com/jedisct1/libsodium/releases/download/1.0.3/libsodium-1.0.3.tar.gz
LIBZMQ_URL=https://github.com/zeromq/libzmq.git
#start
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
tmpdir=`mktemp -d`
@thorrr
thorrr / check-and-restart-net.sh
Last active Aug 29, 2015
Run this in a one minute cron job to check network connectivity every 20 seconds
View check-and-restart-net.sh
#!/bin/bash
LOCKFILE=/tmp/check-and-restart.lock
if ! mkdir "${LOCKFILE}" 2>/dev/null; then
echo "check-and-restart is already running." >&2
exit 1
fi
trap "rm -rf ${LOCKFILE}; exit" INT TERM EXIT
@thorrr
thorrr / Makefile
Created Jan 23, 2014
Bloomberg OpenAPI: build python bindings
View Makefile
bloomberg_c_url := http://cdn.gotraffic.net/open/blpapi_cpp_3.7.5.1-windows.zip
bloomberg_python_url := http://cdn.gotraffic.net/open/blpapi-py-3.5.3.zip
artifacts_dir := artifacts
install_dir := Blpapi
UNZIP = unzip $| -d $$d
#UNZIP = tar -xf $| -C $$d
.PHONY: all clean downloads clean_downloads install repl
@thorrr
thorrr / Makefile
Last active Jan 2, 2016
Makefile for building quantlib + python extensions.
View Makefile
.PHONY: all downloads clean clean_downloads
### URLS ########
boost_url := 'http://downloads.sourceforge.net/project/boost/boost/1.53.0/boost_1_53_0.tar.bz2'
quantlib_url := 'http://sourceforge.net/projects/quantlib/files/QuantLib/1.2.1/QuantLib-1.2.1.tar.gz'
quantlib_swig_url := 'http://sourceforge.net/projects/quantlib/files/QuantLib/1.2/other%20languages/QuantLib-SWIG-1.2.tar.gz'
#################
#### subdirectory names #####
ql_swig_install_dir := quantlib-swig-install
boost_dir := boost_1_53_0
@thorrr
thorrr / Makefile
Last active Jan 2, 2016
Makefile for building cling from source. Works on win32 cygwin, need to modify the exename variable to make it work on Linux
View Makefile
cling-version := 45925
install-dir := $(shell pwd)/cling
exename := $(install-dir)/bin/cling.exe
.PHONY: all clean exe clang cling repl crepl cpprepl
all: exe
clean:
rm ./lastKnownGood
@thorrr
thorrr / turn-off-messaging.el
Created Dec 25, 2012
Emacs advice to temporarily turn off writing messages to the minibuffer. Goes nicely with real-auto-save mode.
View turn-off-messaging.el
;; the following is copied from http://lists.gnu.org/archive/html/help-gnu-emacs/2005-01/msg00636.html
(defvar messaging-on t
"Control whether or not messages will be printed; by default, they are.")
;; Note that by itself this renders edebug pretty useless.
(defadvice message (around nomessage activate)
"Turn off messaging most of the time.
Whether or not messages are displayed is determined by the value
of the variable `messaging-on'."
(when messaging-on