Skip to content

Instantly share code, notes, and snippets.

View mlgill's full-sized avatar

Michelle Gill mlgill

View GitHub Profile
@mlgill
mlgill / jupyter_collapse_headings_html
Created August 30, 2018 22:52 — forked from tarokiritani/jupyter_collapse_headings_html
small script to collapse headings in jupyter notebook after converted to html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
var all_cells = $("div.cell");
$.each(all_cells, function( index, value ) {
if ($(value).find("h1").length == 0){
$(value).hide()
} else{
var bare_h1 = $(value).find("h1").text()
@mlgill
mlgill / docker_hygiene.sh
Created May 17, 2018 21:48
Docker Cleanup
# Remove all exited containers
docker rm `docker ps -a -q --filter status=exited` 2>/dev/null
# Remove any orphaned containers related to "INSERT_CONTAINER_NAME_HERE"
docker rm `docker ps -a -q --filter ancestor=INSERT_CONTAINER_NAME_HERE` 2>/dev/null
# Remove any orphaned images from aborted/old builds
docker rmi `docker images -q -f "dangling=true"` 2>/dev/null
# Clean up whatever disk-hogging stuff Docker leaves lying aroung
@mlgill
mlgill / amsgrad.py
Created February 2, 2018 16:10 — forked from kashif/amsgrad.py
Keras implementation of AMSGrad optimizer from "On the Convergence of Adam and Beyond" paper
class AMSgrad(Optimizer):
"""AMSGrad optimizer.
Default parameters follow those provided in the Adam paper.
# Arguments
lr: float >= 0. Learning rate.
beta_1: float, 0 < beta < 1. Generally close to 1.
beta_2: float, 0 < beta < 1. Generally close to 1.
epsilon: float >= 0. Fuzz factor.
@mlgill
mlgill / setup_aws_gpu.sh
Last active April 3, 2019 22:19
Setup AWS GPU instance
#!/bin/bash
####################################################################################
## AWS GPU Instance Setup Script ##
## Michelle L. Gill ##
## michelle@michellelynngill.com ##
## Gist location: https://gist.github.com/mlgill/63114af65d9dd3e1c386b03a02c199b7 ##
## Date updated: 2017/05/27 ##
####################################################################################
@mlgill
mlgill / Gaussian_elimination.py
Created April 11, 2017 14:07 — forked from mikofski/Gaussian_elimination.py
numpy scipy gaussian elimination using LU decomposition with pivoting
#! /usr/bin/env python
"""
Solve linear system using LU decomposition and Gaussian elimination
"""
import numpy as np
from scipy.linalg import lu, inv
def gausselim(A,B):
@mlgill
mlgill / README.md
Last active November 23, 2022 18:02
Sets up a data science focused conda environment use a specified python version and path.

Automated Conda Setup

Michelle L. Gill
Updated: 2017/05/20

Regularly updated Gist located here.

This bash script will download and setup a Conda environment on Mac OS X or Linux using a specified Python version (2.7, 3.6) and packages. The Conda installation path and environment name can also be specified. All settings are input at the beginning of the script (see below).

If the Conda directory exists and can be determined to be a Conda installation, a new environment will be created. If the directory does exist but does not appear to be a Conda installation, the script will quit to avoid accidentally overwriting a file.

@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
},
@mlgill
mlgill / instant_jupyter_notebook.zsh
Last active March 23, 2016 14:30
Downloads the conda install script, creates an environment with basic scientific packages, and launches a jupyter notebook. Ideally want the environment to be cleaned up at the end.
#!/usr/bin/env zsh
# set Linux/Darwin url
if [[ `uname` == "Darwin" ]]; then
echo "Detected Mac OS X..."
url="http://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh"
else
echo "Detected Linux..."
url="http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh"
fi
# 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 / keybase.md
Created January 21, 2016 13:05
Keybase.io Identity Verification

Keybase proof

I hereby claim:

  • I am mlgill on github.
  • I am mlgill (https://keybase.io/mlgill) on keybase.
  • I have a public key whose fingerprint is 64D5 7A40 E2C2 1E49 EF96 F194 E45F 4767 96F8 74BB

To claim this, I am signing this object: