Skip to content

Instantly share code, notes, and snippets.


Jonathan Sick jonathansick

View GitHub Profile

EUPS distrib binary "tarball" products

The EUPS distrib facility (eups distrib ...) has support for packaging and publishing binary builds in a package format called "tarballs". Unlike the "eupspkg" (source) package format that was the sole DM published product format, "tarballs" are inherently tied to the microarchitecture and ABI of a platform. As there are currently multiple supported "stack" build platforms, a means of coordinating multiple independent binary builds from identical sources is needed both to ensure consistency of product versions across platforms and

from sre_parse import Pattern, SubPattern, parse as sre_parse
from sre_compile import compile as sre_compile
from sre_constants import BRANCH, SUBPATTERN
class Scanner(object):
def __init__(self, tokens, flags=0):
subpatterns = []
pat = Pattern()
jhoblitt /
Created Nov 12, 2015
Build a graph of the EUPS product dependencies
git clone
cd build-graph/
virtualenv deps
. deps/bin/activate
pip install -r requirements.txt
./ b1780.txt
View change-resource-record-sets.json
"Comment": "A new CNAME for jsick's Read the Docs documentation.",
"Changes": [
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "",
"Type": "CNAME",
"SetIdentifier" : "Read the Docs",
"Weight": 10,
PBarmby /
Created Jan 5, 2015
Deals with making a LaTeX table with uncertainties and correct number of significant figures
from astropy.table import Table, Column, join, vstack
from uncertainties import ufloat
import astropy.units as u
def uncert_str(tab_row, col_name, value_fmt):
''' format tab_row[col_name] single table row in LaTeX $num \pm unc$ format
input: tab_row: single row from an astropy table
col_name: name of column to be extracted and formatted
value_fmt: format for string output
cmod / minimal_fb_messenger.css
Last active Dec 6, 2019
Minimal Facebook Messenger for Fluid
View minimal_fb_messenger.css
Minimal Facebook Messenger
1. Make a Fluid ( instance of
1. a. (You need to buy the paid version of Fluid to modify UserStyles)
2. Apply the below CSS as a Userstyles stylesheet
3. Like magic, you can now message without all the cruft of Full Facebook
jonathansick /
Last active Aug 29, 2015
A checklist for uploading to PyPI, because I always forget.

First time:

python register

Uploading a new version:

python check
PBarmby /
Created Mar 4, 2014
Computes deprojected galactocentric distances
from astropy.coordinates import ICRS, Galactic, Distance, Angle
from astropy import units as u
import math as mt
import numpy as np
from astropy.table import Table, Column
# inspired by
def correct_rgc(coord, glx_ctr=ICRS('00h42m44.33s +41d16m07.5s'), glx_PA=Angle('37d42m54s'), glx_incl=Angle('77.5d'), glx_dist=Distance(783,unit=u.kpc)):
'''computes deprojected galactocentric distance for an object at coord,
gruber / Liberal Regex Pattern for Web URLs
Last active Nov 17, 2020
Liberal, Accurate Regex Pattern for Matching Web URLs
View Liberal Regex Pattern for Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "". For a pattern that attempts to
match all URLs, regardless of protocol, see:
# Single-line version:
hest / gist:8798884
Created Feb 4, 2014
Fast SQLAlchemy counting (avoid query.count() subquery)
View gist:8798884
def get_count(q):
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
count = q.session.execute(count_q).scalar()
return count
q = session.query(TestModel).filter(...).order_by(...)
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ...
print q.count()
You can’t perform that action at this time.