Skip to content

Instantly share code, notes, and snippets.

View MichaelCurrie's full-sized avatar

Michael Currie MichaelCurrie

View GitHub Profile
@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 / awss3connect.md
Last active March 25, 2021 12:05
Connecting your local machine to an S3 bucket

Connecting your local machine to an S3 bucket

Steps to get a file on your local machine uploaded to an AWS S3 bucket, and then downloaded and used in an AWS EC2 Ubuntu Instance. (In this case we do the reverse, but the process is similar)

STEP 1

Get security credentials to be able to use the AWS command line utility:

@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 / 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 / python_multiprocessing_example.py
Last active May 23, 2020 02:49
Python multiprocessing example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A basic example using multiple processes
We spawn 4 processes. Each process is made to draw N/4 random
integers from 1 to 10, for some fixed large N.
Then the processes adds up its list of numbers, passes it into a queue,
and the main program adds up the subtotals to get a grand total.
@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 / autopep8 Travis-CI.md
Last active April 26, 2021 17:18
Automatically fix PEP-8 issues using Travis-CI

PEP-8 is a set of Python style recommendations. pep8 is a module that checks your .py file for violations. To make your Travis-CI build fail if you have any violations, you could add these lines to your .travis.yml:

before_install:
    - pip install pep8
    
script:
    # Run pep8 on all .py files in all subfolders
    # (I ignore "E402: module level import not at top of file"
    # because of use case sys.path.append('..'); import <module>)
@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 / 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