Skip to content

Instantly share code, notes, and snippets.

rduplain /
Created May 8, 2012
A very simple full-screen WebView activity for Android native wrappers, as a starting point.
package com.willowtreeapps.demo;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
View zwave-js-hank-scn04-4-button-remote.yaml
name: Hank Four-button Scene Controller
description: Create automations for Hank Electronics / Technisat 4-button remote using the ZWave-JS integration
domain: automation
name: Hank Four-button Controller
rduplain /
Created Oct 17, 2011
Connect to MSSQL using FreeTDS / ODBC in Python.

Goal: Connect to MSSQL using FreeTDS / ODBC in Python.

Host: Ubuntu 11.10 x86_64


sudo apt-get install freetds-dev freetds-bin unixodbc-dev tdsodbc
pip install pyodbc sqlalchemy

In /etc/odbcinst.ini:

rduplain /
Created May 20, 2012
Add a second static directory to Flask, in ../static/.
from flask import Flask, send_from_directory
app = Flask(__name__)
def base_static(filename):
return send_from_directory(app.root_path + '/../static/', filename)
rduplain / vpn
Last active Oct 10, 2021
OpenVPN rc.d script for VPN client on BSD (i.e. jail): connect to VPN, start another service once VPN is connected.
View vpn
# PROVIDE: vpn
# KEYWORD: shutdown
# vpn: connect to VPN, start another service once VPN is connected.
# Uses OpenVPN and assumes the configuration does not need any authentication
# beyond the given .conf file. Consider an approach using `expect` if needed:
rduplain /
Last active Jul 23, 2021
Bootloader configuration for multiple .iso files on a USB drive.
# Use grub to boot .iso files directly from /boot/iso.
# This file lives at /etc/grub.d/25_iso and is executable.
# Open .iso files to inspect internal /boot files for grub config hints.
# /boot is on the third partition of a gpt-partitioned USB drive.
ISO_PART_UUID="0a5086cd-8fdf-4ae0-a248-67411ebbbb18" # UUID of /boot `blkid`.
rduplain /
Created Jan 19, 2012
Plot a PNG using matplotlib in a web request, using Flask.
"Plot a PNG using matplotlib in a web request, using Flask."
# Install dependencies, preferably in a virtualenv:
# pip install flask matplotlib
# Run the development server:
# python
rduplain / haproxy-servers.cfg
Last active Jun 16, 2021
Rewrite haproxy configuration and reload service.
View haproxy-servers.cfg
# Edit this file then run `update-haproxy haproxy-servers.cfg`.
# Alternatively, use a shell pipeline to build server list `... | update-haproxy`.
server demo1 check cookie demo1 weight 100
server demo2 check cookie demo2 weight 100
server demo3 check cookie demo3 weight 0
server demo4 check cookie demo3 weight 0
rduplain / Makefile
Created Apr 27, 2013
Makefile for key interactions on a Flask project deployed on heroku.
View Makefile
# Key project interactions, but not all dependencies are resolved by make.
@heroku help
python runserver
python shell
rduplain / match.hy
Last active Dec 22, 2020
Getting started with hy (, a simple example.
View match.hy
#!/usr/bin/env hy
;; match.hy - Getting started with hy (, a simple example.
;; As executable, `chmod +x match.hy`:
;; $ ./match.hy '(.*), (.*)!' 'Hello, world!'
;; ('Hello', 'world')
;; Developed on hy master 14c412c (after 0.11.1) on Python 3.5.