Skip to content

Instantly share code, notes, and snippets.

View djsutherland's full-sized avatar

Danica J. Sutherland djsutherland

View GitHub Profile
#!/usr/bin/python
'''
Script to set the OSX desktop background to the top picture from a given
subreddit.
NOTE: sets it for the current space (on all monitors), but not other spaces.
There doesn't seem to be an AppKit API to change it for all spaces.
TODO: set it in the sqlite db instead:
http://1klb.com/blog/desktop-background-on-os-x-109-mavericks.html/
#!/usr/bin/env osascript
-- based on http://stackoverflow.com/a/23018886/344821
tell application "System Events" to tell process "SystemUIServer"
set bt to (first menu bar item whose description is "bluetooth") of menu bar 1
click bt
tell (first menu item whose title is "CMU keyboard") of menu of bt
click
tell menu 1
if exists menu item "Connect"
click menu item "Connect"
#include <mex.h>
#include <math.h>
#define INDEX_TYPE_ID mxUINT8_CLASS
#define INDEX_TYPE uint8_T
void get_fourier_coefs(const double * X, const INDEX_TYPE * inds,
const double * mins, const double * ptps,
int num_pts, int dim, int num_bases, int M,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@djsutherland
djsutherland / update_imdb.py
Last active January 1, 2016 15:59
Updates IMDB dumps without making on-disk uncompressed copies.
#!/usr/bin/env python
'''
Updates an IMDB data dump (http://www.imdb.com/interfaces) fully-automatically,
without making any uncompressed copies on disk because those are big.
Note that this runs slower than it could because, well, it's Python. Works with
pypy, though. I haven't done any profiling or anything to see where the
slowdowns are.
'''
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>[]</title>
<style type="text/css">
.clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";line-height:0;}
.clearfix:after{clear:both;}
.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;}
.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}
#!/usr/bin/env python
from email.utils import parseaddr
import re
from imapclient import IMAPClient, SEEN
DEFAULT_SEARCH = "(from:*@*.gov OR from:*@*.edu OR from:*@*.mil OR from:*@tiaa-cref.mkl-et.com) AND NOT label:!!!unspam"
DEFAULT_RE = '(.*\.(gov|edu|mil)$)|(.*@tiaa-cref\.mkl-et\.com$)'
DEFAULT_TARGET_LABELS = '!!!unspam'
We can make this file beautiful and searchable if this error is corrected: Any value after quoted field isn't allowed in line 7.
post_date post_title comment_count group_concat(terms.name)
2007-03-02 14:24:27 Economics hires two tenure-track professors 0 dtraber
2007-05-03 08:41:50 Pericles Project grants 0 lstokes
2007-05-03 08:43:43 ITS Director Judy Downing to Retire 0 mskorpe1
2007-05-02 08:44:58 Student Council report and election results 0 lstokes
2007-05-02 08:45:55 Worth Director Linda Echols reflects on her time at Swarthmore and prepares for retirement 0 mskorpe1
2007-05-02 08:47:10 "Blackness" only one of many competing identities in the Black diaspora, says historian Neptune 0 lstokes
2007-05-07 10:20:08 Two juniors win Rockefeller Teaching Fellowships 0 lstokes
2007-05-07 10:21:58 Gazette Schedule 0 dailygazette
2007-05-08 08:35:18 What's the structure behind Papazian? 0 lstokes