Skip to content

Instantly share code, notes, and snippets.

@dkess
dkess / keybase.md
Created February 4, 2017 23:05
Keybase Proof

Keybase proof

I hereby claim:

  • I am dkess on github.
  • I am dkess (https://keybase.io/dkess) on keybase.
  • I have a public key ASD6tPuAwA-qOEpyjybvyxgjIuuvpwYsh8hKPhZjA9ZrZwo

To claim this, I am signing this object:

# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
#theme = "solarized-dark"
theme = "gruvbox-dark"
icons = "awesome"
[[block]]
block = "music"
buttons = ["prev", "next"]
max_width = 50
[[block]]
@dkess
dkess / recovery.sh
Created April 25, 2020 03:13
dkess's recovery script
#!/bin/bash
# gpg -o env -d env.gpg
# sudo systemd-run -p DynamicUser=1 -p PrivateTmp=1 --working-directory=/tmp --setenv=HOME=/tmp -p EnvironmentFile="$(realpath recovery.env)" --pty --wait --service-type=exec recovery.sh
set -euo pipefail
export GPG_TTY=$(tty)
gpg --import /dev/stdin <<< "$GPGKEY"
unset GPGKEY
@dkess
dkess / send_to_matrix.py
Last active September 6, 2020 20:35
zero-dependency python script to send a message to a matrix room
#!/usr/bin/env python3
"""
Take a message on stdin and send it to a Matrix room.
Works on Python 3.5+
Example:
echo 'hello world' | send_to_matrix.py --homeserver matrix.org --access-token-file /path/to/accesstoken --room '!YiweMkCfAD:matrix.org'
"""
@dkess
dkess / discourse-sso.py
Created June 29, 2018 06:07
Implementation of Discourse's SSO in Python Flask
# Implementation of Discourse's SSO in Python Flask.
# Assumes username is passed as 'X-WEBAUTH-USER' HTTP header
import base64
import binascii
import hashlib
import hmac
import urllib.parse
from flask import abort, Flask, redirect, request