Skip to content

Instantly share code, notes, and snippets.

@bchartoff
bchartoff / email to calendar
Last active September 29, 2021 01:44
An AppleScript to automatically create a calendar event from an e-mail containing a date and time of the form "March 10, 2015 12:00 - 2:00 PM". Distributed under MIT license (see below)
(*
Create Calendar event from Message
*)
set theContent to string
-- A subroutine to strip all tags from html
on remove_markup(this_text)
set copy_flag to true
set the clean_text to ""
repeat with this_char in this_text
import urllib, urlparse
import re
import random
import numpy
API_KEY = "SDQL_KEY"
# I want to jiggle Y and Yo?
def jiggler(lst,jiggle):
return [x + jiggle * ( random.random() - 0.6 ) for x in lst]
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 6.
Policy or Program,What it does     ,Policy proposals tested by TRIM3
Earned Income Tax Credit ,Provides refundable credits for low-income working families ,"Tested two options for increasing the EITC, including an increase of 40 percent in the maximum credit"
Child and Dependent Care Tax Credit ,A non-refundable credit to cover expenses for child care or care for an incapacitated dependent ,"Tested a fully-refundable credit with higher rates for families with under $70,000 adjusted gross income, but no eligibility over $70,000"
Child Care and Development Fund ,Federally-funded child care subsidies,Guarantee a subsidy to eligible families under 150 percent of poverty
Minimum Wage,Federally-mandated wage of $7.25 per hour,Tested increasing the wage to $10.25 per hour by 2020; second option set a ceiling of 10th percentile of state’s actual wages
Supplemental Nutrition Assistance Program (SNAP),"Federal entitlement program that gives in-kind, noncash benefits to eligible adults and children ","Tested increasin
@bchartoff
bchartoff / Sports_heatmaps
Created December 19, 2013 17:30
SDQL and plotly API scripts to generate sports score heatmaps.
import urllib, urlparse
import re
import random
import numpy
API_KEY = "SDQL_KEY"
# I want to jiggle Y and Yo?
def jiggler(lst,jiggle):
return [x + jiggle * ( random.random() - 0.6 ) for x in lst]
import csv
import json
import subprocess
jData = []
remap = {"Custodial Arrest":"custodial","NonCustodial Arrest":"noncustodial","Contact":"contact"}
cr = csv.reader(open("data/source_data.csv",'rU'))
@bchartoff
bchartoff / .bash_profile
Created January 29, 2015 16:16
My .bash_profile
#aliases
alias ll="ls -lha"
alias h=history
alias hg="history | grep"
alias ..="cd .."
#Path
export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/local/git/bin:/bin:/usr/sbin:/sbin:~/bin
#Sublime
@bchartoff
bchartoff / oldfaithfuldoublehist
Created December 11, 2013 01:54
Old faithful data with histograms on both axes in plotly
#combine elements with same name in two named lists (useful for combining layouts)
appendList <- function (x, val)
{
stopifnot(is.list(x), is.list(val))
xnames <- names(x)
for (v in names(val)) {
x[[v]] <- if (v %in% xnames && is.list(x[[v]]) && is.list(val[[v]]))
appendList(x[[v]], val[[v]])
else c(x[[v]], val[[v]])
}
@bchartoff
bchartoff / oldfaithful
Created December 10, 2013 22:21
Code to create multi axis plots in Plotly
#combine elements with same name in two named lists (useful for combining layouts)
appendList <- function (x, val)
{
stopifnot(is.list(x), is.list(val))
xnames <- names(x)
for (v in names(val)) {
x[[v]] <- if (v %in% xnames && is.list(x[[v]]) && is.list(val[[v]]))
appendList(x[[v]], val[[v]])
else c(x[[v]], val[[v]])
}
####################################
# diamond data bar chart
# Questions? Email feedback@plot.ly
# For more docs, see plot.ly/api
####################################
library(plotly)
py <- plotly(username='USERNAME', key='API_KEY')
####################################
# diamond data bar chart
# Questions? Email feedback@plot.ly
# For more docs, see plot.ly/api
####################################
library(plotly)
py <- plotly(username='USERNAME', key='API_KEY')