Skip to content

Instantly share code, notes, and snippets.

@thorrr
thorrr / .dir-locals.el
Created March 5, 2024 14:52
.dir-locals.el: auto activate virtualenv called "venv" in python project directory
((nil . (
(eval . (setq pyvenv-activate (concat (locate-dominating-file default-directory ".dir-locals.el") "/venv/")))
(eval . (setq lsp-pylsp-server-command
(concat (locate-dominating-file default-directory ".dir-locals.el") "/venv/bin/pylsp")))
)))
@thorrr
thorrr / .tmux.conf
Created March 3, 2024 14:40
tmux.conf - change leader key to `
# Change prefix key to backtick (`)
unbind C-b
set-option -g prefix `
bind ` send-prefix
# history size - number of lines
set -g history-limit 100000
####################################
# make scroll/"copy" mode friendlier
@thorrr
thorrr / jupyter_6.sh
Created March 3, 2024 14:13
Install the latest Jupyter 6.xx with extensions activated
#!/usr/bin/env bash
# shellcheck disable=SC2155 # irrelevant because of set -e
set -euo pipefail
readonly VENV_NAME=venv
readonly BLACK_LINE_LENGTH=110
readonly packages=(
@thorrr
thorrr / disable-luks.sh
Last active October 5, 2017 15:51
Disable password on encrypted LUKS drive
#!/bin/bash
set -euf -o pipefail
##################
# User variables
#################
KEY_SLOT=5
DEVICE=/dev/sda5
PASSWORD=password

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 January 16, 2017 18:43 — forked from ryane/five_minutes.yml
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
#!/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 January 4, 2017 23:40
install ipython notebook under cygwin
#!/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 August 29, 2015 14:04
Run this in a one minute cron job to check network connectivity every 20 seconds
#!/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 January 23, 2014 22:29
Bloomberg OpenAPI: build python bindings
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