Skip to content

Instantly share code, notes, and snippets.

View jdmonaco's full-sized avatar
🤖

Joseph Monaco jdmonaco

🤖
View GitHub Profile
@jdmonaco
jdmonaco / iTunes.sh
Last active December 19, 2015 07:59
Want to use VLC or other superior media apps that respond to keyboard media keys (play/pause, etc) and iTunes keeps getting in the way? Run iTunes.sh to disable normal launching of iTunes. Then this script becomes how you launch iTunes if you need to for some god-forsaken reason. (The sleep helps prevent the rename from occurring before the open…
#!/bin/sh
ITUNES=/Applications/iTunes.app/Contents/MacOS/iTunes
if [ -f $ITUNES ]; then
sudo mv $ITUNES ${ITUNES}X
echo iTunes disabled.
fi
sudo mv ${ITUNES}X $ITUNES &&
@jdmonaco
jdmonaco / t_welch.py
Last active February 2, 2021 10:00
Welch's t-test for two samples, not assuming equal sample size or variance. Requires Python, NumPy, and SciPy.
from collections import namedtuple
import numpy as np
import scipy.stats as st
TtestResults = namedtuple("Ttest", "T p")
def t_welch(x, y, tails=2):
"""
Welch's t-test for two unequal-size samples, not assuming equal variances
@jdmonaco
jdmonaco / makegif
Created August 18, 2013 20:45
TextExpander snippet for creating an animated gif on the command-line using the ImageMagick convert utility.
convert -delay %filltext:name=delay x0.01s:default=10:width=2% -resize %filltext:name=width:default=256:width=3% %filltext:name=glob:default=IMG*.JPG% %filltext:name=output:default=output.gif%
@jdmonaco
jdmonaco / chrome_navigate.scpt
Created August 25, 2013 17:20
For browser-based presentations and other uses, it is useful to control browser navigation from outside the browser. This Applescript can be run from the command line or even other scripts (e.g., a python daemon that receives remote events) to send arrow key events to the currently active Chrome window. Optionally specify "command" to send a com…
#!/usr/bin/osascript
on run argv
set browser to "Chrome"
set leftKey to 123
set upKey to 126
set downKey to 125
set rightKey to 124
@jdmonaco
jdmonaco / organize-photos.py
Last active October 29, 2021 20:35 — forked from cliss/organize-photos.py
Update of @cliss's update of Dr. Drang's photo management scripts. Replaced shutil calls with subprocess calls. Added a log file that gets written to the destination directory. Source can now be a directory tree (using os.walk). Replaced comments/docstrings with slightly better code organization and function names. Replaced path string concatena…
#!/usr/bin/env python
"""
organize-photos.py - Organize an unstructured folder tree of photos and movie
files into a month-and-year folder structure.
Note: This is a minor rewrite of @cliss's extension [1,2] of @drdrang's
photo management scripts [3], and includes a tweak from @jamiepinkham [4,5].
The lists of raw [6] and video [7] file extensions were found elsewhere.
@jdmonaco
jdmonaco / skim-mate-relay.scpt
Created June 11, 2014 20:24
To fix backward-search synchronization (SyncTeX) between Skim and TextMate set Skim > Preferences > Sync > Preset to "Custom" with the command pointing to this script file and Arguments set to '%line "%file"' (without the single quotes). The problem is that (for as yet unknown reasons) the Shift-Cmd-click in Skim started opening a new editor win…
#!/usr/bin/osascript
on run argv
set mateScript to "mate -l " & item 1 of argv & " " & item 2 of argv
tell application "Terminal"
set thisTab to do script mateScript
set visible of window 1 to false
delay 0.5
@jdmonaco
jdmonaco / user-link-system-wallpapers.sh
Created August 27, 2014 22:32
A quick script to link OS X Mavericks system desktop wallpapers into your user '~/Library/Desktop Pictures' folder. This way you can delete links to wallpapers you don't want.
@jdmonaco
jdmonaco / xcorr_maxlag.py
Created June 6, 2015 21:55
An example of a lag-limited correlation function for spike train data.
"""
Limited-lag numpy implementation of spike train cross-correlation.
"""
import numpy as np
def xcorr(a, b, maxlag=1.0, bins=128):
"""
Compute the cross-correlogram of two spike train arrays.
"""
Spike train cross-correlogram methods.
"""
import time
import numpy as np
import matplotlib.pyplot as plt
from scipy import real
from scipy.fftpack import fft, ifft
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.