Skip to content

Instantly share code, notes, and snippets.

View stefco's full-sized avatar
😳

Stefan Countryman stefco

😳
View GitHub Profile
@stefco
stefco / constants.py
Last active May 8, 2016 04:07
a buncha constants that come in handy while doin some calculations!!! use em for astrophysics or whatever, i don't care1!!!
# a buncha constants that come in handy while doin some calculations!!!
# just copy and paste this and run it in your ipython or julia interpreter,
# what are you worried about?? it's just a buncha constants, i didn't
# make em up, i'm just usin em!!!!!
alpha = 0.00729927 # fine structure constant
k = 1.38064852e-23 # boltzman constant (J/K)
keV = 8.6173324e-5 # boltzman constant (eV/K)
Na = 6.022140857e23 # avogadro constant (1/mol)
RgasJ = 8.3144598 # gas constant (J/(K mol))
atm = 1.013e5 # 1 atmosphere (N/m^2)
@stefco
stefco / three-fingered-claw.sh
Last active May 27, 2016 15:38
The Three Fingered Claw
#!/bin/sh
# good for error-logging and mixing safe/unsafe execution
LOGFILE=/dev/stderr # default
log() { echo "$(date +'%D %H:%M:%S:') $*" >> "$LOGFILE"; }
die() { log "$*"; exit 111; }
try() { "$@" || die "Invalid: $*"; }
@stefco
stefco / shibb-cas-get.sh
Created April 14, 2016 01:23 — forked from olberger/shibb-cas-get.sh
Connection to a web app protected via Shibboleth with curl
#!/bin/sh
#set -x
# Usage: shibb-cas-get.sh {username} {password} # If you have any errors try removing the redirects to get more information
# The service to be called, and a url-encoded version (the url encoding isn't perfect, if you're encoding complex stuff you may wish to replace with a different method)
DEST=https://myapp.example.com/
SP=https://myapp.example.com/index.php
IDP="https://myidp.example.com/idp/shibboleth&btn_sso=SSOok"
@stefco
stefco / donkey.sh
Last active April 25, 2016 06:12
Donkey, get back in the heap
#!/bin/bash
# install a powerful script with a special productivity advantage for mac users
(
cat <<-LAYERS
cat <<-OGRESARELIKELAYERS
,M, 7M=
= MMMM, M