Skip to content

Instantly share code, notes, and snippets.

@simonrw
simonrw / brew config
Last active December 20, 2015 02:19
Homebrew issue with luarocks #21382 With luarocks installed, the command `brew outdated` recompiles lots of lua code.
> brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew.git
HEAD: c288e866c467531b0a1943d6a3fdd4fe4ea88610
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: dual-core 64-bit penryn
OS X: 10.7.5-x86_64
Xcode: 4.6.3
CLT: 4.6.0.0.1.1362189000
@simonrw
simonrw / git-quick
Created September 5, 2013 22:11
git-quick file for quick git commit messages
#!/usr/bin/env bash
set -e
# This runs git commit -m but allows any arguments to be compiled into the message
# instead of requiring the wrapping with quotes
git commit -m "$*"
@simonrw
simonrw / vim bundles file
Created September 16, 2013 21:06
vim-polyglot errors
" Global setup
" -------------
" Set no vi compatible
set nocompatible
" Nice vundle stuff
filetype off
let g:vundle_default_git_proto = 'git'
@simonrw
simonrw / Makefile
Last active August 29, 2015 13:57
Quick file to read the floating point magnitude column from a strangely formatted fits file
all: read_fits
read_fits: read_fits.c
gcc $< -o $@ -lcfitsio -Wall -Wextra
@simonrw
simonrw / catalogue_hdu_example.py
Last active August 29, 2015 14:03
Code examples for the NGTS wiki page
'''
Read in the catalogue RA and DEC positions and plot as a scatter plot
'''
from astropy.io import fits
import matplotlib.pyplot as plt
with fits.open("example.fits") as hdulist:
catalogue = hdulist['catalogue'].data
ra = catalogue['ra']
{
"metadata": {
"name": "",
"signature": "sha256:2a604bad3f98e76127138bde3e00c443f63d0dad9aacb9eb3eb134c8037c2c5c"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@simonrw
simonrw / gist:7c58b0a2eebbe03f88a7
Created December 5, 2014 15:46
CCD geometry for the prototype
{
"metadata": {
"name": "",
"signature": "sha256:1e02e5c975ff47422f513d8acc59dcba3a82095ade7ca789b0b2203ddf223201"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"metadata": {
"name": "",
"signature": "sha256:5fddeb641c99360902951f4e05e71fa0f22d867941f2dd43429f5ebb3d5b3fca"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
2015-02-03 08:44:06 +0000
cmake
.
-DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/mariadb/10.0.16
-DCMAKE_FIND_FRAMEWORK=LAST
-DCMAKE_VERBOSE_MAKEFILE=ON
-DMYSQL_DATADIR=/usr/local/var/mysql
-DINSTALL_INCLUDEDIR=include/mysql
-DINSTALL_MANDIR=share/man
@simonrw
simonrw / pythonmodule.c
Last active August 29, 2015 14:15
Simple boilerplate code for wrapping C code into either python 2 or 3, taken from the porting guide: https://docs.python.org/3/howto/cporting.html
#include "Python.h"
/*********************************************************************************
* Taken from the porting guide: https://docs.python.org/3/howto/cporting.html
*
* Change all occurrences of
* - myextension => the extension name you want to create,
* - error_out => the function(s) you want to wrap
* - METH_NOARGS => METH_VARARGS|METH_KWARGS depending on if the function
* takes keyword arguments or not