Skip to content

Instantly share code, notes, and snippets.

View tdsmith's full-sized avatar

Tim D. Smith tdsmith

View GitHub Profile
Log time: 2014-04-19 21:54:43.794614
Log time: 2014-04-19 21:54:57.000539
Log time: 2014-04-19 21:55:25.484416
MarkInstall cracklib-runtime [ i386 ] < 2.8.22-1 -> 2.9.1-1build1 > ( admin ) FU=0
ignore old unsatisfied important dependency on wamerican:i386
MarkInstall iputils-ping [ i386 ] < 3:20121221-1ubuntu1 -> 3:20121221-4ubuntu1 > ( net ) FU=0
new important dependency: libcap2-bin:i386
Installing libcap2-bin as Recommends of iputils-ping
MarkInstall libcap2-bin [ i386 ] < none -> 1:2.24-0ubuntu2 > ( utils ) FU=0
Installing libpam-cap as Recommends of libcap2-bin
require "formula"
class Vpython < Formula
url "https://downloads.sourceforge.net/project/vpythonwx/6.10-release/vpython-wx-src.6.10.tgz"
sha1 "d51ca07dad92a1ae9a3d5cc57af48b180f457228"
head "https://github.com/BruceSherwood/vpython-wx.git"
homepage "http://vpython.org/"
# no python3 support from Homebrew boost yet
depends_on :python
require "formula"
class UniversalPython < Requirement
satisfy(:build_env => false) { archs_for_command("python").universal? }
def message; <<-EOS.undent
A universal build was requested, but Python is not a universal build
Boost compiles against the Python it finds in the path; if this Python
is not a universal build then linking will likely fail.
@tdsmith
tdsmith / diff.rb
Last active August 29, 2015 14:03
require "formula"
class UniversalPython < Requirement
satisfy(:build_env => false) { archs_for_command("python").universal? }
def message; <<-EOS.undent
A universal build was requested, but Python is not a universal build
Boost compiles against the Python it finds in the path; if this Python
is not a universal build then linking will likely fail.
require "formula"
class UniversalPython < Requirement
satisfy(:build_env => false) { archs_for_command("python").universal? }
def message; <<-EOS.undent
A universal build was requested, but Python is not a universal build
Boost compiles against the Python it finds in the path; if this Python
is not a universal build then linking will likely fail.
df = data.frame(id=1:20)
flags = numeric(20)
flags[c(5,7)] = 1
df$flag = flags
to_copy = numeric(20) * NA
ptr = 1
for (i in seq_along(df$id)) {
if(!df[i, "flag"]) next
candidates = c((i-5):(i-1), (i+1):(i+5))
df = data.frame(id=rep(c("A","B","C","D"), each=5),n=1:20)
flags = numeric(20)
flags[c(4,5,7)] = 1
df$flag = flags
reduce_me = function(df, flagname)
{
to_copy = integer(NROW(df)*2) * NA
ptr = 1
for (i in seq_along(df[,1])) {
library(plyr)
library(dplyr)
donors = read.csv("donors.csv", header=TRUE, stringsAsFactors=FALSE,
na.strings=c("", " "))
names(donors) = tolower(names(donors))
library(lubridate)
donors$donation_time = parse_date_time(donors$donation_time,
orders=c("ymdhms", "mdyImsp"),
tz="America/Chicago")
donors[which.min(donors$donation_time), "donation_time"] = as.POSIXct("2014/05/01 00:00", tz="America/Chicago")
import cairo
import numpy as np
from PIL import Image
# imdata is a 2D numpy array of dtype np.uint8 containing grayscale pixel intensities on [0, 255]
# repeat for each of R, G, B, and add a deck of 255s for alpha
cairo_imdata = np.dstack([imdata, imdata, imdata, np.ones_like(imdata)*255])
surface = cairo.ImageSurface.create_for_data(cairo_imdata, cairo.FORMAT_ARGB32, *(reversed(imdata.shape)))
# create a context and do some doodling
@tdsmith
tdsmith / -
Created August 22, 2014 01:51
>>> s = pd.Series(["foo", "bar", "bar"])
>>> t = pd.Series(["foo", "bar", "baz"])
>>> s.value_counts() - t.value_counts()
bar 1
baz NaN
foo 0