Skip to content

Instantly share code, notes, and snippets.

View MichaelCurrie's full-sized avatar

Michael Currie MichaelCurrie

View GitHub Profile
@MichaelCurrie
MichaelCurrie / mp3toogg.py
Created August 26, 2015 21:10
Convert all MP3 files to OGG in all folders and subfolders.
# -*- coding: utf-8 -*-
"""
Convert all MP3 files to OGG in all folders and subfolders starting
at the location of this source file.
@author: Michael Currie
"""
import os, collections
from glob import glob
@MichaelCurrie
MichaelCurrie / BeatlesWebScrape.py
Last active August 29, 2015 14:03
Lennon vs McCartney Screen-Scraping Utility
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 22 22:26:53 2014
Scrape a website to find content on Beatles Rankings
@author: @MichaelCurrie
http://michaelcurrie.com/blog/2014/7/7/john-lennon-vs-paul-mccartney-a-quantitative-analysis
@MichaelCurrie
MichaelCurrie / buildozer_make.sh
Created October 1, 2015 15:15
Makefile for buildozer.
#!/bin/bash
# run this from ~/github/Lanki
# Remove any previous buildozer files from the folder
buildozer android clean
git pull
# Create the .buildozer folder and download its subcomponents, including the blacklist.txt file we are about to modify
buildozer android update
@MichaelCurrie
MichaelCurrie / wormMovementPlot.py
Last active December 23, 2015 11:39
Simple worm movement plotter. Also saves animation to mp4.
import math
import os
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
import h5py
#SPEED_UP = 4
#DT = 0.05
@MichaelCurrie
MichaelCurrie / time_conversions.py
Last active January 19, 2016 04:09
ISO 8601 UTC timestamp recipe
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Here we use timezone-aware datetime objects, as opposed to timezone-naive ones.
Source: Python manuals, stackoverflow posts, trial and error.
"""
from datetime import datetime
import time
@MichaelCurrie
MichaelCurrie / SIMSUN.ttf
Last active June 3, 2016 19:00
Kivy SoundLoader with chinese characters in sound path
This file has been truncated, but you can view the full file.
@MichaelCurrie
MichaelCurrie / GUI_on_ubuntu.sh
Created August 7, 2016 13:32
Access GUI on Amazon Ubuntu instance
#==========================================================================================================
# Access GUI of machine
# 1. Install the Ubuntu Desktop we'll be connecting to
sudo apt-get update
sudo apt-get install -y ubuntu-desktop
# 2. Install a server that will allow remote machines to connect
sudo apt-get install -y x11vnc
# Configure the password for the server (alabaster)
@MichaelCurrie
MichaelCurrie / split_bubbles_d3.html
Created November 4, 2016 04:21
Splitting bubbles using d3.js v4
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.button {
min-width: 130px;
padding: 4px 5px;
cursor: pointer;
text-align: center;
font-size: 13px;
border: 1px solid #e0e0e0;
@MichaelCurrie
MichaelCurrie / month_normalized_year_fraction.sql
Last active February 4, 2017 21:12
Years between dates, with "sticky" months
CREATE FUNCTION sandbox.MonthNormalizedYearDiff(@StartDate DATE, @EndDate DATE)
RETURNS FLOAT
AS
BEGIN
/*
MONTH-NORMALIZED YEAR DIFF
How many years are between 31 December 2015 and 31 January 2016, say? You could say
31 days in January / 366 days in the year 2016. But notice how if I then try to
"de-annualize" the resulting fraction, I can't multiply by 12, since 31/366 != 1/12.
@MichaelCurrie
MichaelCurrie / README.md
Created June 12, 2017 02:05 — forked from ThomasThoren/README.md
Map distance scales

Example of how to create dynamic map distance scales.