Skip to content

Instantly share code, notes, and snippets.

conn = pymysql.connect(
host=os.environ['MYSQL_HOST'],
user=os.environ['MYSQL_USERNAME'],
password=os.environ['MYSQL_PASSWORD'],
database='enwiki_p',
charset='utf8',
use_unicode=True
)
@atdt
atdt / README
Last active December 22, 2020 12:53
A minimal ssh-agent for using a smartcard with PIV for public-key authentication with OpenSSH through PKCS11.
org.wikimedia.ssh-pkcs11-agent.plist -> ~/Library/LaunchAgents
OPENSC_LIBS=/usr/local/Cellar/opensc/0.15.0/lib
ssh-add -s $OPENSC_LIBS/opensc-pkcs11.so
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active May 9, 2025 01:58
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@tresni
tresni / gist:83b9181588c7393f6853
Last active September 7, 2024 02:35
Authy to 1Password

Moving Authy to 1Password

1Password 5.3 for OSX, 5.2 for iOS, and 4.1.0.538 for Windows support OTP. I've been using Authy for a while now, but the fact is, I haven't really been using 2FA for some time. As mentioned by 1Password in a recent blog post, having the OTP generator and password on the same device is very much not 2FA. It's just an expiring OTP, which can help, but let's not kid ourselves too much.

With that out of the way. One of the things that was interesting to me was moving my OTP out of Authy and into 1Password. I like the control I get with 1Password, but I didn't want to have to reset all my OTP right away, that would suck. So, I got to dissecting the Authy Chrome App to see what I could do.

Run the Authy Chrome app and make sure it's unlocked.

Now, enable Developer mode in Chrome. We'll need this to inspect the background application that stores al

@bendechrai
bendechrai / mailman-discard-ban.user.js
Last active January 12, 2017 17:17
Mailman Always Discard and Ban (Greasemonkey Script)
// ==UserScript==
// @name Mailman Always Discard and Ban
// @namespace https://bendechrai.com/
// @description Automatically selects "Discard" and ticks the "Add" and Ban" checkboxes on Mailman admin requests for pending messages
// @downloadURL TBA
// @match *://*/mailman/admindb/*
// @match *://*/lists/admindb/*
// @version 1
// @grant none
// ==/UserScript==
@werdnum
werdnum / README.md
Last active August 29, 2015 14:15
Labs-Vagrant on your own VM

I like labs-vagrant, and I like it even better when I can run it on my own server.

Eight commands to get labs-vagrant on your own Ubuntu server, from scratch.

# apt-get install puppet git
# git clone https://git.wikimedia.org/git/operations/puppet.git
# cd puppet
# git checkout -B production origin/production
# cd ..
@mgwilliams
mgwilliams / lxc-agent-forward.sh
Last active September 30, 2020 13:50
example of how to forward ssh-agent into an lxc
#!/bin/bash
# Example Script to forward ssh-agent socket into an unprivileged lxc
# This allows access to the ssh-agent by commands executed with lxc-attach
set -m
CONTAINER=$1 # e.g., test-container
REMOTE=$2 # e.g, [email protected]
from statistics import median, mean
import time
import re
import requests
import subprocess
warmups = 15
trials = 15
hosts = ('osmium', 'mw1020')
headers = {'host': 'en.wikivoyage.org'}
@cmaureir
cmaureir / sge_status.md
Last active October 5, 2023 17:22
Sun Grid Engine SGE state letter symbol codes meanings
@clarkdave
clarkdave / logstash-sentry.rb
Last active May 15, 2023 11:34
(Logstash) Sentry output plugin
# The MIT License (MIT)
# Copyright (c) 2014 Dave Clark
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: