Skip to content

Instantly share code, notes, and snippets.

View tdsmith's full-sized avatar

Tim D. Smith tdsmith

View GitHub Profile
@tdsmith
tdsmith / gist:5768065
Created June 12, 2013 18:54
ctypes.macholib.dyld.dyld_default_search
def dyld_default_search(name, env=None):
yield name
framework = framework_info(name)
if framework is not None:
fallback_framework_path = dyld_fallback_framework_path(env)
for path in fallback_framework_path:
yield os.path.join(path, framework['name'])
import tifffile as tf
import numpy as np
from os.path import splitext
def z_project(fn):
tiff = tf.TiffFile(fn)
n = len(tiff.pages)
immap = np.arange(n).reshape((-1, 2), order='F')
d = {}
d['cars'] = immap[:-1,0]
wilma:~ tim$ brew deps --tree tbb
tbb
wilma:~ tim$ brew remove tbb
Uninstalling /usr/local/Cellar/tbb/4.2...
wilma:~ tim$ brew install tbb
==> Downloading https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb42_20130725oss_src.tgz
Already downloaded: /Library/Caches/Homebrew/tbb-4.2.tgz
==> Patching
patching file build/version_info_macos.sh
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])) {