Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am dfkoz on github.
  • I am dfkoz (https://keybase.io/dfkoz) on keybase.
  • I have a public key whose fingerprint is 9EDB 78D2 0FE7 E236 D163 CAE0 E82E CB9C 309E 0B77

To claim this, I am signing this object:

@dfkoz
dfkoz / Movie Data
Last active August 29, 2015 14:02
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'net/http'
open('results.txt', 'wb') do |file|
(1 .. 94000).step(50).to_a.each do |start|
dir_url = 'http://www.imdb.com/search/title?at=0&sort=num_votes,desc&start=%s&title_type=tv_series' % start.to_s
puts dir_url
@dfkoz
dfkoz / gist:7442030
Last active December 28, 2015 04:19
preferences {
section("Monitor the temperature...") {
input "temperatureSensor", "capability.temperatureMeasurement"
}
def installed() {
subscribe(temperatureSensor, "temperature", temperatureHandler)
}
def updated() {
@dfkoz
dfkoz / gist:5860786
Last active June 30, 2023 12:49
The Honeymailer sends a random photo from Google Drive at a preset interval.
// HOW TO USE THIS SCRIPT:
// 0. Upload your photos to Google Drive.
// 1. Log into Google Drive, and click CREATE -> Script -> Blank Project.
// 2. Delete all of the default code, and paste this code into your project.
// 3. Customize the email parameters below to your liking (note that the quotes around each line are very important.)
// 4. Test the script by selecting Run -> sendRandomPic. You should receive an email with a random picture.
// 5. Click Resources -> Current Project's Triggers, and set up the email to run as often as you would like.
// Name of the folder that contains your photos.
// Leave blank to search your top-level folder.
@dfkoz
dfkoz / truth_in_browsing_script
Created October 20, 2012 18:48
TruthInBrowsing Script
document.body.innerHTML = document.body.innerHTML.replace(
/I have read and agree to/g,
"I haven't read but nevertheless agree to"
);
@dfkoz
dfkoz / truth_in_browsing_manifest
Created October 20, 2012 18:29
TruthInBrowsing Manifest
{
"name": "TruthInBrowsing",
"version": "1.2",
"manifest_version": 2,
"description": "This extension makes browsing a more truthful experience.",
"icons": {
"128":"icon128.png",
"48":"icon48.png"
},
"permissions": [
@dfkoz
dfkoz / twitter_api_php
Created July 27, 2012 00:59
Simple PHP Code to Query Twitter Search API
// This address links to the Twitter search API, and asks for tweets related to tacos
$tweet_url = “http://search.twitter.com/search.json?q=tacos&rpp=100&include_entities=true&result_type=recent&geocode=40.7142,-74.0064,25mi&since_id=$since_id”;
// Load the Twitter API results into a variable
$json_response = file_get_contents($tweet_url);
// Decode the raw data into a form usable by PHP
$parsed = json_decode($json_response);
// Print out the text of each tweet
@dfkoz
dfkoz / 2012-02-07-PACData-Graphs.R
Created February 7, 2012 23:22
R source code for three simple graphs -- summary bar chart, histogram, and duration curve -- based on Super PAC contribution data.
# Set the default working directory & load the data
setwd("C:\\Users\\owner\\Dropbox\\Other\\Super PAC Data\\")
pac <- read.csv("Super_PAC.csv")
# First, let's segment the data by political leaning
liberal_pac <- subset(pac, pac$C.L == "Liberal")
conserv_pac <- subset(pac, pac$C.L == "Conservative")
nonpart_pac <- subset(pac, pac$C.L == "Nonpartisan")
################################################
@dfkoz
dfkoz / 2012-02-06-EdData-BarChart-R
Created February 6, 2012 16:13
R code used to create and save a time-lapse bar chart
# Set up the bar colors
bar_color <- c("dodgerblue4", "darkseagreen4", "firebrick4")
# Set up the column name vector
col_names <- c("Public", "Private", "Total")
# clean up old images
file.remove(list.files(pattern=".png"))
# Loop through each year in the dataset