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 / 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 / manual-rebuild.py
Last active October 16, 2018 19:04
Manually perform the "rebuild" conda-forge operation (update for Python 3.7, etc.)
#! /usr/bin/env python
from conda_forge_tick import auto_tick
import networkx as nx
HARDCODED_GRAPH_PATH = '/home/peter/sw/conda/cf-graph3/graph.pkl'
def go(package_name, recipe_dir):
print('= A ==================================================================')
gx = nx.read_gpickle(HARDCODED_GRAPH_PATH)
@pkgw
pkgw / bindings.rs
Created May 27, 2018 19:27
Example generated slurm-sys Rust binding code
/* automatically generated by rust-bindgen */
pub const SLURM_SUCCESS: u32 = 0;
pub const SLURM_ERROR: i32 = -1;
pub const SLURM_FAILURE: i32 = -1;
pub const SLURM_SOCKET_ERROR: i32 = -1;
pub const SLURM_PROTOCOL_SUCCESS: u32 = 0;
pub const SLURM_PROTOCOL_ERROR: i32 = -1;
pub const SLURM_VERSION_NUMBER: u32 = 1116933;
pub const SLURM_PENDING_STEP: u32 = 4294967293;
@pkgw
pkgw / 20180123.txt
Last active January 25, 2018 14:01
Check Travis CI queue for conda-forge feedstocks
Repo 1 of 3827 ...
Repo 101 of 3827 ...
Repo 201 of 3827 ...
Repo 301 of 3827 ...
Repo 401 of 3827 ...
Repo 501 of 3827 ...
Repo 601 of 3827 ...
Repo 701 of 3827 ...
Repo 801 of 3827 ...
Repo 901 of 3827 ...
1/643 pyagrum-feedstock build #61 job #1 277.50 days
2/643 pyagrum-feedstock build #61 job #2 277.50 days
3/643 pyagrum-feedstock build #61 job #3 277.50 days
4/643 staged-recipes build #13059 job #1 277.50 days
5/643 python-blosc-feedstock build #28 job #1 277.50 days
6/643 python-blosc-feedstock build #28 job #2 277.50 days
7/643 python-blosc-feedstock build #28 job #3 277.50 days
8/643 staged-recipes build #13061 job #1 277.50 days
9/643 staged-recipes build #13063 job #1 277.50 days
10/643 mumps-feedstock build #24 job #1 277.50 days
@pkgw
pkgw / five-hours.diff
Created January 23, 2018 22:23
Change in the list of pending conda-forge Travis CI jobs, sorted by job id, 2018 Jan 23, five hour time span
--- diffable-earlier.txt 2018-01-23 17:19:00.965739367 -0500
+++ diffable-later.txt 2018-01-23 17:18:56.938713677 -0500
@@ -145,6 +145,19 @@
flask-sqlalchemy-feedstock build #13 job #2
flask-sqlalchemy-feedstock build #13 job #3
staged-recipes build #13877 job #1
+pvlib-python-feedstock build #28 job #1
+pvlib-python-feedstock build #28 job #2
+pvlib-python-feedstock build #28 job #3
+staged-recipes build #25180 job #1
@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
#! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2016 Peter Williams <peter@newton.cx> and collaborators.
# Licensed under the MIT License.
# XXX remove hashbang
"""Compute phase closure diagnostics from a Measurement Set
For most results to make sense, the data should be observations of a bright
@pkgw
pkgw / chandra_repro.py
Created March 28, 2016 22:25
Overcomplicated untested work on automagical ninja pipeline for X-ray processing
# -*- mode: python; coding: utf-8 -*-
# Copyright 2016 Peter Williams <peter@newton.cx> and collaborators.
# Licensed under the MIT License.
"""Framework to call the CIAO chandra_repro program in the context of a Ninja
build system.
"""
from __future__ import absolute_import, division, print_function, unicode_literals