Skip to content

Instantly share code, notes, and snippets.

View andycasey's full-sized avatar

Andy Casey andycasey

View GitHub Profile
@jobovy
jobovy / post-commit
Last active October 3, 2016 17:10
Modified version of Andy Casey's (@andycasey) post-commit hook to run latexdiff between different revisions of a latex draft (see http://astrowizici.st/blog/2013/10/04/publishing-with-git); works on Macs and when the paper is in a sub-directory of the main git repository.
#!/bin/sh
# Post-commit hook for revision-awsm-ness
function gettempfilename()
{
tempfilename=$1-$RANDOM$RANDOM.tex
if [ -e $tempfilename ]
then
tempfilename=$(gettempfilename)
@sloria
sloria / bobp-python.md
Last active May 12, 2024 06:54
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@adrn
adrn / sgr_example.py
Last active December 17, 2015 01:19
Transform to and from Sagittarius coordinates in Python
import astropy.units as u
from astropy.coordinates import ICRSCoordinates
from streams.coordinates import SgrCoordinates, OrphanCoordinates
icrs = ICRSCoordinates(15.34167, 1.53412, unit=(u.hour, u.degree))
sgr = icrs.transform_to(SgrCoordinates)
print(sgr.Lambda, sgr.Beta)
orp = sgr.transform_to(OrphanCoordinates)
print(orp.Lambda, orp.Beta)
@iamatypeofwalrus
iamatypeofwalrus / roll_ipython_in_aws.md
Last active January 22, 2024 11:18
Create an iPython HTML Notebook on Amazon's AWS Free Tier from scratch.

What

Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.

What are we using? What do you need?

  • An active AWS account. First time sign-ups are eligible for the free tier for a year
  • One Micro Tier EC2 Instance
  • With AWS we will use the stock Ubuntu Server AMI and customize it.
  • Anaconda for Python.
  • Coffee/Beer/Time
@JeffPaine
JeffPaine / make_github_issue.py
Created July 19, 2012 17:24
Make an issue on github using API V3 and Python
import json
import requests
# Authentication for user filing issue (must have read/write access to
# repository to add issue to)
USERNAME = 'CHANGEME'
PASSWORD = 'CHANGEME'
# The repository to add this issue to
REPO_OWNER = 'CHANGEME'
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@eteq
eteq / issue2pr.py
Created February 6, 2012 08:23
Python function/script to convert github issues to pull requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Requires python >=2.6
"""
Tool to convert github issues to pull requests by attaching code. Uses the
github v3 API. Defaults assumed for the `astropy <http://www.astropy.org>`_
project.
"""
from __future__ import print_function
IMPORTANT: this is outdated, go to https://github.com/netroy/Lockets
"npm install socket-io" & you are ready to go
@JakeWharton
JakeWharton / hookpuller.py
Created November 7, 2009 00:57
Takes a GitHub service hook POST and automatically updates the associated repo.
#!/usr/bin/env python
'''
Takes a GitHub service hook POST and automatically updates the associated repo.
'''
__license__ = '''
Copyright 2009 Jake Wharton
hookpuller is free software: you can redistribute it and/or modify