Skip to content

Instantly share code, notes, and snippets.

View mlgill's full-sized avatar

Michelle Gill mlgill

View GitHub Profile
@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 / numpy_ndarray_views.py
Last active December 18, 2015 11:09
Explanation of issue with multiplying matrices element-wise and numpy ndarray views. This is what caused to the difference between the numpy and fortran pulse propagator functions in my blog post (http://themodernscientist.com/posts/2013/2013-06-09-simulation_of_nmr_shaped_pulses/)
import numpy as np
a = np.eye(3)
b = np.eye(3)
c = np.eye(3)
for i in range(10):
d = np.random.random((3,3))
# copy each matrix element individually
d00 = d[0,0].copy()
#!/bin/zsh
#### BEGIN USER CONFIG OPTIONS ####
# Path to the data file to watch for modifications
local_progress_file="/path/to/file_that_is_periodically_modified"
# Interval in minutes to wait between queries
# Must be an integer
interval_min=30
#!/bin/zsh
#### BEGIN USER CONFIG OPTIONS ####
# Path to the data file to watch for modifications
local_progress_file="/path/to/file_that_is_periodically_modified"
# Interval in minutes to wait between queries
# Must be an integer
interval_min=30
@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 / 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 / gist_update_batch.py
Created January 8, 2014 02:31
gist_update_batch: iOS (Pythonista), updates selected scripts to GitHub Gists
import sys, os, re
sys.path += ['lib']
import keychainsetup, github3
# gist_update_batch
# by Michelle L. Gill, michelle@michellelynngill.com
# A script to batch update pythonist scipts. Scripts to be updated must
# have the following the first line formatted as such:
#
@mlgill
mlgill / dropboxsetup.py
Created January 8, 2014 02:57
dropboxsetup: iOS (Pythonista), attempts to handle Dropbox auth token creation and login seamlessly
import dropbox, os, webbrowser
# A generic Dropbox module to create a token and login.
# Michelle L. Gill, 2014/01/06
# To use:
# import dropboxsetup
# sess, client = dropboxsetup.init(TOKEN_FILENAME, APP_KEY, APP_SECRET)
# TOKEN_DIRECTORY can be set to store tokens in a folder, set to "Tokens" by default
@mlgill
mlgill / DropboxSync.py
Last active February 12, 2019 18:11 — forked from wrenoud/DropboxSync.py
DropboxSync: iOS (Pythonista), synchronizes all files to/from Dropbox directory
import os, sys, pickle, console, re
sys.path += ['lib']
import dropboxsetup
# dropbox_sync
# by Michelle L. Gill, michelle@michellelynngill.com
# requires my dropboxsetup module (https://gist.github.com/8311046)
# Change log
@mlgill
mlgill / image_joiner.py
Last active January 2, 2016 13:39
image_joiner: iOS (Pythonista) and Mac OS X, joins two images horizontally or vertically
import sys, Image, math
# Join two images together, either horizontally or vertically,
# with resizing to match joined dimension. Works on Mac OS X or iOS.
# On Mac OS X, the Python Imaging Library is required
# On iOS, Pythonista is required
# Michelle L. Gill, 2014/01/20
# Padding and borders
padding = 10