Skip to content

Instantly share code, notes, and snippets.

View pkgw's full-sized avatar

Peter Williams pkgw

View GitHub Profile
@pkgw
pkgw / partial .XCompose
Last active January 13, 2024 13:06
A fragment of a ~/.XCompose file that adds compose-key combinations for typing Greek letters, blackboard bold capitals, and a nonbreaking space.
# PKGW customizations
# Greek ambiguities: epsilon/eta, theta/tau, pi/phi/psi, omega/omicron
<Multi_key> <backslash> <comma> : " " U202F # thin nonbreaking space
<Multi_key> <g> <a> : "α"
<Multi_key> <g> <b> : "β"
<Multi_key> <g> <g> : "γ"
<Multi_key> <g> <d> : "δ"
<Multi_key> <g> <3> : "ε" # note!
@pkgw
pkgw / uval.py
Created April 4, 2013 02:38
"The worst possible way to propagate uncertainties."
"""
The worst possible way to propagate uncertainties.
"""
import numpy as np
from scipy.stats import scoreatpercentile as sap
n = 1024
uplaces = 1 # the argument is that you generally only know your uncerts to 1 place
udtype = np.double
@pkgw
pkgw / xpdf-extract-helper.sh
Created October 15, 2012 14:22
Helper to use XPDF to extract figures from PDFs as vector graphics
#! /bin/bash
# -*- shell-script -*-
margin=4
# XPDF gives its y coordinates in terms of the standard PDF coordinate
# system, where (0,0) is the bottom left corner and y increases going
# up. But pdftocairo uses Cairo coordinates, in which (0,0) is the top
# left corner and y increases going down. We can use pdfinfo to get
# the page size to translate between these conventions.
@pkgw
pkgw / otpounce.py
Created August 26, 2012 04:01
Pounce on an OpenTable reservation
#! /usr/bin/env python
"""
Pounce on an open OpenTable reservation.
"""
import sys, os, time, re, mechanize, gtk, webkit, threading, random
rid = 1180 # OpenTable restaurant ID; 1180 = French Laundry
people_choices = [3, 3, 3, 4] # number of people to request for; cycles through choices
@pkgw
pkgw / gist:1436133
Created December 6, 2011 00:43
SMA miriad merge diff
commit e07320d824afcdc19d85104259659b55221b1858
Author: Peter Williams <peter@newton.cx>
Date: Mon Oct 18 17:21:07 2010 -0700
Incorporate new SMA files into autotools build.
diff --git a/src/prog/sma/Makefile.am b/src/prog/sma/Makefile.am
index 916739a..72e906a 100644
--- a/src/prog/sma/Makefile.am
+++ b/src/prog/sma/Makefile.am
@pkgw
pkgw / gist:1143360
Created August 13, 2011 01:24
SOMETHING HAS GONE TERRIBLY WRONG
#include <casa/Exceptions/Error.h>
#include <casa/iostream.h>
#include <synthesis/MeasurementEquations/Imager.h>
#include <synthesis/MeasurementComponents/EPJones.h>
#include <ms/MeasurementSets/MSHistoryHandler.h>
#include <casa/Arrays/Matrix.h>
#include <casa/Arrays/ArrayMath.h>
#include <casa/Arrays/ArrayLogical.h>