Skip to content

Instantly share code, notes, and snippets.

# Fetches data from
# API documentation
from datetime import datetime, timedelta
import time
import requests
from influxdb import InfluxDBClient
import paho.mqtt.client as mqtt
pamolloy /
Last active Sep 18, 2022
Ubiquiti USG configuration for Wireguard

Download the latest ugw3 package from and install it on your USG using dpkg -i wireguard-ugw3-<version>.deb.

cd /config/auth
umask 077
mkdir wireguard
cd wireguard
wg genkey > wg_private.key
wg pubkey < wg_private.key > wg_public.key

Setup Mac OS X

I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.

I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...

<!DOCTYPE html>
<html lang="en-US">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noodp, noydir" />
<link rel="dns-prefetch" href="//">
<link rel="canonical" href="" />
<link rel="stylesheet" href="" type="text/css" />
View .fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
Documented at
To check font mapping run the command at terminal
$ fc-match 'helvetica Neue'
rufuspollock /
Last active Apr 14, 2016
UPDATED VERSION NOW AT [Script to load CSV to SQLite]
#!/usr/bin/env python
# A simple Python script to convert csv files to sqlite (with type guessing)
# @author: Rufus Pollock
# Placed in the Public Domain
import csv
import sqlite3
def convert(filepath_or_fileobj, dbpath, table='data'):
if isinstance(filepath_or_fileobj, basestring):

Google Speech To Text API

Base URL:
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

The client's name you're connecting from. For spoofing purposes, let's use chromium

Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

gruber / inline2ref.rb
Created Sep 9, 2011 — forked from ttscoff/inline2ref.rb
Convert inline Markdown links to references
View inline2ref.rb
#!/usr/bin/env ruby
def e_sh(str)
str.to_s.gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\').gsub(/\n/, "'\n'").sub(/^$/, "''")
def find_headers(lines)
in_headers = false
lines.each_with_index {|line, i|
if line =~ /^\S[^\:]+\:( .*?)?$/
View emacs.pdf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.