Skip to content

Instantly share code, notes, and snippets.

@dkess
dkess / send_to_matrix.py
Last active Sep 6, 2020
zero-dependency python script to send a message to a matrix room
View send_to_matrix.py
#!/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 / recovery.sh
Created Apr 25, 2020
dkess's recovery script
View recovery.sh
#!/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
View i3status.toml
#theme = "solarized-dark"
theme = "gruvbox-dark"
icons = "awesome"
[[block]]
block = "music"
buttons = ["prev", "next"]
max_width = 50
[[block]]
View gist:3c2585088276b55b2bc7f329b93d3b29
# 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!
@dkess
dkess / discourse-sso.py
Created Jun 29, 2018
Implementation of Discourse's SSO in Python Flask
View discourse-sso.py
# 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
View keybase.md

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: