This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assuming 'response' is the source of a You Tube video page, this will get the flv url | |
var vid = id.substring(3); | |
var r = response; | |
var doc = r.substring(r.indexOf(".swf?video_id=")); | |
var tpoint = r.indexOf("&t="); | |
var doc = r.substring(tpoint, r.indexOf("\"", tpoint)); | |
var url = "http://youtube.com/get_video.php?video_id="; | |
url += vid + doc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# This is a simple Twitter bot which listens to a track stream for a comma delimited | |
# list of terms/tags (PRIMARY_TRACK_LIST). From this stream, it will retweet any | |
# tweet that matches the secondary regex (SECONDARY_REGEX_FILTER). | |
# | |
# This example is a #Haiti & #Chile Twitter stream listener for TweakTheTweet syntax. | |
# | |
# Requires Python 2.6 | |
# Requires Tweepy http://github.com/joshthecoder/tweepy | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CVExtras { | |
PImage pImage; | |
int[] hist = new int[256]; // Raw Pixel Counts | |
double[] histN = new double[256]; // Pixel Percentages (Normalized) | |
double entropy; | |
CVExtras(PImage img) { | |
for (int i = 0; i < 256; i++) { | |
this.hist[i] = 0; | |
this.histN[i] = 0.0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Light painting / POV demo for Raspberry Pi using | |
# Adafruit Digital Addressable RGB LED flex strip. | |
# ----> http://adafruit.com/products/306 | |
import RPi.GPIO as GPIO, Image, time | |
# Configurable values | |
filename = "hello.png" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Type 0: stacked area, 1: themeriver, 2: streamgraph | |
areaGraph <- function(thedata, type=2, smooth=TRUE) { | |
## Color palette | |
nColors <- 15 | |
## pal <- colorRampPalette(c("#0f7fb4", "#e2e2e2")) | |
## pal <- colorRampPalette(c("#6364a9", "#e2e2e2")) # Purple | |
pal <- colorRampPalette(c("#48611d", "#f0f0f0")) | |
colors <- pal(nColors) | |
weights <- rowSums(thedata) | |
## Sort the data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Get the DOIs for an ACM DL Citation. | |
### | |
### David A. Shamma - GNU 2.0 License | |
### | |
## Call like this: | |
## get_citations('1290082.1290120', True) | |
## or just the tail/acm id | |
## get_citations('1290120') | |
## | |
## Prints to the console: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RGBCountrViewController.swift | |
// RGBCountr | |
// | |
// Created by David A. Shamma on 4/9/15. | |
// Some parts taken from around the web. | |
// | |
// Simply take one photo and remember it, | |
// then count the RGB diff from the next photo. | |
// Ideally one should do this via histograms but this was quick. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f.name <- "file.csv" | |
f.command <- paste("wc -l", | |
f.name, | |
"| cut -d \" \" -f 2") | |
f.rows <- as.numeric(system(f.command, intern = TRUE)) | |
f <- read.csv(f.name, | |
nrows=f.rows, | |
col.names=c("user", "phone", "total", "percent"), | |
colClasses=c("numeric","numeric","numeric","numeric"), | |
header=FALSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(RColorBrewer) | |
library(maptools) | |
library(ggplot2) | |
library(mapproj) | |
library(rgdal) | |
## make sure you call | |
gpclibPermit() | |
data(wrld_simpl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Terminal notifier | |
;; requires 'sudo port install terminal-notifier' | |
;; stolen from erc-notifier | |
;; | |
;; (terminal-notifier-notify "Emacs notification" | |
;; "Something amusing happened") | |
(defvar terminal-notifier-command | |
(executable-find "terminal-notifier") |
OlderNewer