Skip to content

Instantly share code, notes, and snippets.

View awade's full-sized avatar

Andrew Wade awade

  • The Australian National University
  • Canberra, Australia
View GitHub Profile
/***************************************************
Temperature logger
Must use ESP8266 Arduino from:
https://github.com/esp8266/Arduino
Works with Adafruit's Huzzah ESP board:
----> https://www.adafruit.com/product/2471
Adapted from code Written by Todd Treece.
@awade
awade / PTWtoTIFF.m
Created September 22, 2017 03:05
This is a simple matlab script for converting WiDy .ptw raw video files to batches of .tiff files. Code is drawn from their manual, have added a bit to write out to tiff.
% Converts PTW raw video files (from WiDy software) to batches of tiff
% files sequentially numbered.
% Andrew Wade
% awade@ligo.caltech.edu
% September 2017
% Adapted from example code given on p10 of WiDy SWIR User Manual
@awade
awade / Dockerfile
Last active November 25, 2017 07:28
This is a docker file for generating an Alpine linux based image for hosting an elog (https://midas.psi.ch/elog/). You must mount a directory volume into /home with the elogd.cfd file and logbooks folder. Otherwise you must change the final CMD line to point to your elogd config file, preferably on a mounted volume to be persistent between docke…
## Note: This is explicitly broken into stages for debug. To minimize size the run commands must be combined together so that docker doesn't cache files from each stage in layers.
FROM alpine:latest
MAINTAINER Andrew Wade <awade@ligo.caltech.edu>
# Set the working directory to /app
WORKDIR /builddir
# Copy the current directory contents into the container at /app
ADD . /builddir
@awade
awade / local.jupyter.notebook.plist
Created February 14, 2018 07:32
.plist file for running jupyter-notebook in background using launchctl on MacOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>local.jupyter.notebook</string>
@awade
awade / VacuumViewportDesignNotebook.ipynb
Last active April 6, 2018 02:19
Notebook for computing dimensions when designing vacuum viewports. Please comment if you find errors or have improvements.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@awade
awade / nextcloud_docker-compose.yml
Last active May 20, 2018 20:52
Nextcloud docker compose with exposed port, works with jwilder/nginx-proxy and jrcs/letsencrypt-nginx-proxy-companion for SSL/TLS secure access.
version: '2'
volumes:
nextcloud:
nextcloudDB:
services:
db:
image: mariadb
restart: always
@awade
awade / nginxproxy_docker_compose.yml
Last active May 20, 2018 23:27
jwilder/nginx-proxy with lets encrypt docker compose with exposed port, works with jwilder/nginx-proxy and jrcs/letsencrypt-nginx-proxy-companion for SSL/TLS secure access. Runs on network bridge mode so that external containers can trigger action.
# Here external ports are set to 80 (http) and 443 (https with SSL/TLS).
# Change this to a different port if you have a port mapping on your router
# for external access.
#
# This should auto generate certificates and act as a proxy between containers
# and the exposed port when the following is included in your app:
# environment:
# - VIRTUAL_HOST=nextcloud.example.com
# - LETSENCRYPT_HOST=nextcloud.example.com
#
@awade
awade / Baguette.tex
Created June 4, 2018 21:59
Standard recipe for French style baguettes. Compile document using LaTex, compile ingredients using your hands.
\documentclass[a4paper, 11pt]{article}
\usepackage{graphicx} %graphics package for including images
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{float}
\numberwithin{equation}{section}
@awade
awade / triggerIFTTT.py
Last active September 19, 2018 21:07
Simple python function for triggering IFTTT.com maker event. Need to import requests to use and setup event_name and token on the IFTTT.com
import requests
def triggerIFTTT(triggerName, token):
''' Function for triggering events on IFTTT.com
Users must provide a name of the event and a token.
'''
assert isinstance(triggerName, str), "var triggerName should be a string"
assert isinstance(token, str), "var token should be a string"
# Generate url to trigger event
@awade
awade / convOOM.py
Last active April 30, 2019 00:12
Python function returns SI order of magnitude and string prefix. Requires numpy.
def convOOM(x):
'''Function to return tuple with nearest order of mag along with a
string prefix in the correct SI units.'''
assert isinstance(x, float), 'Function expect type float'
assert (1e-24 < x < 1e27), ('Range must be between 1.0e-24 and 1.0e26: '
'Exponent expression might be better choice than SI orders of mag.')
OOMlist = ['y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
OOMnum = np.log10(x) // 3
return x * 10 ** (-3 * int(OOMnum)), OOMlist[int(OOMnum + 8)]