Skip to content

Instantly share code, notes, and snippets.

@stbuehler
stbuehler / example.textile
Created March 25, 2012 17:35
nanoc math helper, example for using Nanoc3::Helpers::Asset
<% math do >
gcd(F_n, F_{n+1}) = 1
<
end %>
@stbuehler
stbuehler / symgpg.py
Created July 12, 2012 14:58
python symmetric gpg with openssl lib (no fork()+exec(gpg))
# Only supports simple symmetric GPG cast5 (cfb)
# iow: gpg -c
import M2Crypto
import hashlib
import struct
import zlib
import random
import time
@stbuehler
stbuehler / excerpt.rb
Created October 9, 2012 20:03
Import mephisto blog into jekyll
# _plugins/excerpt.rb - based on http://blog.darkrefraction.com/2012/jekyll-excerpt-plugin.html
# (added convert detection and don't overwrite already recorded excerpts)
# in layout/post.html capture the content in excerpt as fallback: {% excerpt %}{{ content }}{% endexcerpt %}
module Jekyll
class Excerpt < Liquid::Block
def render(context)
# Get the current post's post object
id = context["page"]["id"]
@stbuehler
stbuehler / PackagesUserlighttpd2-config.tmLanguage
Created October 25, 2012 11:16
sublime lighttpd2 config file highlighting
<?xml version="1.0" encoding="UTF-8"?>
<!-- Packages/User/lighttpd2-config.tmLanguage -->
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
</array>
<key>name</key>
<string>Lighttpd2</string>
@stbuehler
stbuehler / create-gpgring-package.sh
Created November 21, 2012 15:50
create debian apt keyrings and packages
#!/bin/bash
# syntax: $0 -p <packagename> [-a "author <email>"] [-k "my-keyring-filename.gpg"] [-d <destdir for package>] [-v <packageversion>] [--] <keyfiles...>
set -e
selfdir=$(readlink -f "$0")
selfdir=$(dirname "${selfdir}")
tmpdir=$(mktemp --tmpdir -d create-gpgring-package-XXXXXXX)
@stbuehler
stbuehler / sshsystem
Last active October 28, 2023 14:20
ssh wrapper to quote command and arguments for remote end
#!/bin/bash
# quote command in ssh call to prevent remote side from expanding any arguments
# uses bash printf %q for quoting - no idea how compatible this is with other shells.
# http://stackoverflow.com/questions/6592376/prevent-ssh-from-breaking-up-shell-script-parameters
sshargs=()
while (( $# > 0 )); do
case "$1" in
@stbuehler
stbuehler / gnutls-priority.c
Last active December 17, 2015 23:59
List ciphers and other details from GnuTLS priority string
/*
gcc -o gnutls-priority gnutls-priority.c `pkg-config gnutls --cflags --libs` -DTRY_INTERNALS
With -DTRY_INTERNALS it will try to show internal stuff, but the internal API might change
and the feature break.
Example call:
./gnutls-priority "NORMAL:-MAC-ALL:+AEAD"
also check gnutls-cli -c
@stbuehler
stbuehler / tshark-pdml-ssl.xslt
Created June 9, 2013 14:11
display dissected ssl handshakes from `tshark -O ssl -T pdml` output
<?xml version="1.0" encoding="UTF-8"?>
<!-- parses output from: tshark -O ssl -T pdml -->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:math="http://exslt.org/math">
<xsl:output method="text" indent="yes"/>
<xsl:template match="/pdml">
<xsl:call-template name="tcp-stream">
@stbuehler
stbuehler / crontab
Last active December 21, 2015 03:48
https://github.com/swanson/stringer with FastCGI and other stuff
SHELL=/bin/bash
PATH=/home/stringer/.rbenv/bin:/bin/:/usr/bin:/usr/local/bin/:/usr/local/sbin
*/10 * * * * source $HOME/.bash_profile; cd $HOME/stringer/; CRON_JOB=1 bundle exec rake fetch_feeds
@stbuehler
stbuehler / cram-md5.c
Created August 25, 2013 00:36
create {CRAM-MD5} password hashes for dovecot
/*
gcc -o cram-md5 `pkg-config --cflags --libs openssl` cram-md5.c && ./cram-md5
*/
#include <string.h>
#include <openssl/md5.h>
#include <openssl/crypto.h>
static void store_int(unsigned char *d, MD5_LONG l) {