Skip to content

Instantly share code, notes, and snippets.

View mlgill's full-sized avatar

Michelle Gill mlgill

View GitHub Profile
@mlgill
mlgill / keychainsetup.py
Created January 8, 2014 02:29
keychainsetup: iOS (Pythonista), attempts to seamlessly set and get passwords
import keychain
def set_get_user_pass(service):
# store username and password in keychain if not found
if not service in [x[0] for x in keychain.get_services()]:
print 'Keychain does not contain %s username and password.' % service
username = raw_input('Enter your %s username and press enter:' % service)
password = raw_input('Enter your %s password and press enter:' % service)
print 'Username %s and password saved for %s.' % (username, service)
@mlgill
mlgill / rmerge.py
Last active March 8, 2023 18:19
A modified version of pandas merge command that will replace overlapping columns not associated with the join rather than appending a suffix.
import pandas as pa
def rmerge(left,right,**kwargs):
"""Perform a merge using pandas with optional removal of overlapping
column names not associated with the join.
Though I suspect this does not adhere to the spirit of pandas merge
command, I find it useful because re-executing IPython notebook cells
containing a merge command does not result in the replacement of existing
columns if the name of the resulting DataFrame is the same as one of the
@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 / proc.sh
Last active October 17, 2022 18:41
Bash script to display sorted list of processes using most memory or cpu with colorized output
#!/bin/bash
# Michelle L. Gill
# 2014/10/25
# For use with Today Scripts
# http://www.reddit.com/r/osx/comments/2k24ps/today_scripts_widget_update_colorized_output
# Inspired by: https://gist.github.com/anonymous/470bb40b05173fdb6348
# Set this to "cpu" or "mem"
procname="cpu"
@mlgill
mlgill / tmuxp.sh
Last active June 22, 2022 09:43
Execute parallel processes in arbitrary number of tmux panes
#!/bin/bash
# The "tmuxifier"
# Execute parallel processes in an arbitrary number of tmux panes
# This script requires the path to an existing script to
# execute in parallel. Optionally, the number of threads to
# and the name of the tmux session can be input. If threads
# and session name are not entered, threads are determined
# automatically and session names is set to a default.
@mlgill
mlgill / New reminder from Launchbar
Last active May 18, 2021 13:19 — forked from Jayphen/New reminder from Launchbar
A script for quickly adding reminders to the Reminders app in Mountain Lion from Launchbar and Alfred. Save this as a .scpt and drop it in ~/Library/Application\ Support/LaunchBar/Actions
--Script for setting Reminders for LaunchBar and Alfred
--For Alfred, Applescript must NOT be set to run in Background otherwise date parsing does not work
--For LaunchBar, place the script in ~/Library/Scripts/LaunchBar
--by Michelle L. Gill, 10/07/2012
--Inspired by https://gist.github.com/3187630
--A related Alfred version 2 workflow can be found here: https://github.com/mlgill/alfred-workflow-create-reminder
--Changes
--02/01/2013 * Fixed an issue with setting the time when the hour is 12 and AM/PM (12-hour clock) is used
-- * Removed the ability to set seconds for the time since Reminders doesn't recognize them
@mlgill
mlgill / uninstall_adobe_air.sh
Last active May 3, 2021 02:00
Uninstalling Adobe AIR on Mac OS X
#!/bin/sh
# Installing Adobe AIR creates an application called "Adobe AIR Uninstaller" in /Applications/Utilities.
# Unfortunately, running this application does not uninstall the application and instead, it seems to
# unhelpfully confirm that it's installed (http://twitter.com/modernscientist/status/495388916267384833/photo/1).
# The proper way to run this application as an uninstaller is to run the enclosed from the command line
# with the flag "-uninstall" as superuser:
sudo /Applications/Utilities/Adobe\ AIR\ Uninstaller.app/Contents/MacOS/Adobe\ AIR\ Installer -uninstall
@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 / pipista.py
Last active July 30, 2020 23:16 — forked from pudquick/pipista.py
pipista: iOS (Pythonista), attempts to seamlessly download and unpack files from PyPi Changes from fork: (1) fixes xmlrpclib import if _auto_path is False; (2) automatically uncompresses and untars downloaded files.
import os, os.path, sys, urllib2, requests, gzip, tarfile
class PyPiError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def _chunk_report(bytes_so_far, chunk_size, total_size):
if (total_size != None):
@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 ##
####################################################################################