Skip to content

Instantly share code, notes, and snippets.

View mlgill's full-sized avatar

Michelle Gill mlgill

View GitHub Profile
# 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.
@mlgill
mlgill / btsync_control.scpt
Created January 23, 2014 00:18
AppleScript to control throttling of BitTorrent Sync on Mac, optionally using Keyboard Maestro
--Applescript to (un)throtle BitTorrent Sync
--Requires AppleScript Editor to have Accessibility permissions in Mavericks
--Michelle L. Gill, 2014/01/22
--limitBTsync is set to 1 to limit bandwidth or 0 for unlimited bandwidth
--this assumes the appropriate text boxes are already populated with
--the values for limited bandwidth
tell application "Keyboard Maestro Engine"
set limitBTsync to the value of (make variable with properties {name:"limitBTsync"})
end tell
@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
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)
@mlgill
mlgill / ipython_nb_shell.sh
Last active July 23, 2018 04:04
Bash/Zsh functions for viewing/grepping only the input code of an IPython notebook and for clearing output cells.
# Two very basic functions for searching just the input code of an IPython notebook
# Written because I often want to search notebooks for snippets but the giant output
# of embedded encoded images makes it difficult.
# Ipython's nbconvert can be used to extract just the input, but this requires
# writing to a separate file and can be quite slow when used with large notebooks.
# Additionally, find/xargs can be used with igrep when the name of the notebook isn't known.
# icat could be used to convert an IPython notebook to a standard python file if
# the notebook does not contain whole-cell magics.
@mlgill
mlgill / owncloudsetup.md
Last active October 4, 2017 01:53
OwnCloud setup on Ubuntu 14.04

OwnCloud 6 Setup on Ubuntu 14.04

Basic Setup (test prior to adding SSL)

Adapted from here but updated for Ubuntu 14.04 and its apache configuration file location. Most of the instructions in this link did not have to be followed as they were already the defaults and/or the apache files were in different locations

1. Install the appropriate packages: apt-get install owncloud apache2 mysql-server php5 php5-mysql. You will be asked to set a password for the root MySQL user.

2. Ensure apache and mysql are running: sudo /etc/init.d/mysql restart and sudo /etc/init.d/apache2 restart

@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 / gslfft_test.c
Last active August 29, 2015 14:05
Issue with passing wavetable array for use with FFT from GNU Scientific Library
#include <gsl/gsl_fft_complex.h>
#include <stdio.h>
void fft_test(int *dims, gsl_fft_complex_wavetable *wt, gsl_fft_complex_wavetable *wt_x, gsl_fft_complex_wavetable *wt_y, gsl_fft_complex_wavetable *wt_z) {
printf("\nFFT Test\n");
printf("%d, %d, %d\n", dims[0], dims[1], dims[2]); // This is OK
printf("%d, %d, %d\n", wt_x, wt_y, wt_z); // These are equal to values from main function--OK
@mlgill
mlgill / adblock_plus
Last active August 29, 2015 14:07
Useful custom Adblock Plus Filters
(The start of) A personal list of useful Adblock Plus filters.
Add these to the "Add your own filters" section of Adblock Plus.
* Remove Google Plus posts from Google News:
news.google.com##.gpost-bubble