Skip to content

Instantly share code, notes, and snippets.

View jonathansick's full-sized avatar

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
jhoblitt / graph.sh
Created November 12, 2015 16:48
Build a graph of the EUPS product dependencies
git clone https://github.com/lsst-sqre/build-graph.git
cd build-graph/
wget https://raw.githubusercontent.com/lsst/versiondb/master/manifests/b1780.txt
virtualenv deps
. deps/bin/activate
pip install -r requirements.txt
./deps.py b1780.txt
@jmatt
jmatt / change-resource-record-sets.json
Created October 12, 2015 20:03
Bash command to add CNAME
{
"Comment": "A new CNAME for jsick's Read the Docs documentation.",
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "docs.lsst.codes.",
"Type": "CNAME",
"SetIdentifier" : "Read the Docs",
"Weight": 10,
@PBarmby
PBarmby / make_latex_unc_tab.py
Created January 5, 2015 00:28
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
output:
@cmod
cmod / minimal_fb_messenger.css
Last active February 15, 2022 19:11
Minimal Facebook Messenger for Fluid
/*
Minimal Facebook Messenger
==========================
1. Make a Fluid (http://fluidapp.com/) instance of https://facebook.com/messages/
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
jonathansick / pypi_checklist.md
Last active August 29, 2015 14:02
A checklist for uploading to PyPI, because I always forget.

First time:

python setup.py register

Uploading a new version:

python setup.py check
@PBarmby
PBarmby / gal_radii_pb.py
Created March 4, 2014 21:16
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
#http://idl-moustakas.googlecode.com/svn-history/r560/trunk/impro/hiiregions/im_hiiregion_deproject.pro
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
gruber / Liberal Regex Pattern for Web URLs
Last active March 20, 2024 20:28
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
@hest
hest / gist:8798884
Created February 4, 2014 06:08
Fast SQLAlchemy counting (avoid query.count() subquery)
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()