Skip to content

Instantly share code, notes, and snippets.

View mlgill's full-sized avatar

Michelle Gill mlgill

View GitHub Profile
import io
import os
import sys
import types
from IPython.nbformat import current
from IPython.core.interactiveshell import InteractiveShell
def find_notebook(fullname, path=None):
# IMPORTANT SETUP INSTRUCTIONS:
#
# 1. Go to http://www.dropbox.com/developers/apps (log in if necessary)
# 2. Select "Create App"
# 3. Select the following settings:
# * "Dropbox API app"
# * "Files and datastores"
# * "(No) My app needs access to files already on Dropbox"
# * "All file types"
# * (Choose any app name)
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@mlgill
mlgill / gsDL.py
Last active August 29, 2015 14:17 — forked from pudquick/gsDL.py
import re, hashlib, uuid, json, random, os, urllib2, os.path, time, sys, SimpleHTTPServer, SocketServer, string, console, webbrowser, shutil, zipfile
class SmarterHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
server_version = 'SimpleHTTP/0.6'
file_name = ''
def do_GET(self):
if self.path.startswith('/transfer'):
self.get_transfer()
else:
f = self.send_head()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import multiprocessing
import pandas as pd
import numpy as np
def _apply_df(args):
df, func, kwargs = args
return df.apply(func, **kwargs)
def apply_by_multiprocessing(df, func, **kwargs):
workers = kwargs.pop('workers')
@mlgill
mlgill / tserv
Created December 29, 2015 20:27 — forked from jiffyclub/tserv
Start a Tornado static file server in a given directory. To start the server in the current directory: `tserv .`. Then go to `http://localhost:8000` to browse the directory.
#!/usr/bin/env python
"""
Starts a Tornado static file server in a given directory.
To start the server in the current directory:
tserv .
Then go to http://localhost:8000 to browse the directory.
Use the --prefix option to add a prefix to the served URL,
# Source: https://gist.github.com/4145515
#
# All-purpose gist tool for Pythonista.
#
# When run directly, this script sets up four other scripts that call various
# functions within this file. Each of these sub-scripts are meant for use as
# action menu items. They are:
#
# Set Gist ID.py - Set the gist id that the current file should be
# associated with.
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@mlgill
mlgill / scrape_tweets.js
Created April 7, 2016 00:56
Scrape Tweets with CasperJS
var utils = require('utils'),
fs = require('fs'), tweet_account_name,
nbLinks, outputfilename,
header = "Tweet,Timestamp",
stream, css, count = 0, images,
casper = require('casper').create({
viewportSize: {
width: 480,
height: 360
},