Skip to content

Instantly share code, notes, and snippets.

View ryanfb's full-sized avatar

Ryan Baumann ryanfb

View GitHub Profile
@ryanfb
ryanfb / hdhomerun-screenshot.rb
Created October 1, 2016 15:33
Screenshot a random channel from your HDHomeRun device
#!/usr/bin/env ruby
require 'net/http'
require 'json'
# hdhomerun device ASDF found at 10.0.1.1
hdhomerun_discover = `hdhomerun_config discover | head -1`
hdhomerun_ip = hdhomerun_discover.split(' ').last
lineup = JSON.parse(Net::HTTP.get(URI("http://#{hdhomerun_ip}/lineup.json")))
@ryanfb
ryanfb / pleiades-country-filtering.md
Last active September 26, 2016 15:14
Quick-and-Dirty Filtering of Pleiades Places by Modern Country with GDAL ogr2ogr

In this tutorial, I'll give a quick way to filter Pleiades places to those contained within a modern country's borders.

Install GDAL with brew install gdal (on a Mac) or download GDAL binaries for your platform.

Download a modern country's shapefile (for this example, Bulgaria) from GADM: http://www.gadm.org/country

Download the latest Pleiades KMZ data dump. Unzip to KML with unzip pleiades-latest.kmz.

Use the top-level administrative boundary for Bulgaria to clip the resulting tmp/doc.kml file and save the result as GeoJSON:

@ryanfb
ryanfb / deepmask.md
Last active April 4, 2018 19:36
DeepMask / SharpMask training notes

About

These are my public, unorganized notes on stumbling blocks I've run across setting up DeepMask / SharpMask for training: https://github.com/facebookresearch/deepmask

NNProject_DeepMask

An alternative (non-Facebook, Python instead of Torch) open-source implementation of DeepMask was previously available here: https://github.com/abbypa/NNProject_DeepMask

Before the Facebook code was released, I started some work on Dockerizing this implementation which may also help others use it: https://github.com/ryanfb/NNProject_DeepMask/blob/docker_experimental/Dockerfile

### Keybase proof
I hereby claim:
* I am ryanfb on github.
* I am ryanfb (https://keybase.io/ryanfb) on keybase.
* I have a public key whose fingerprint is A93E 5839 3686 F89E 8E79 78CF 4867 2D7A C53C 9D8E
To claim this, I am signing this object:
diff -ur linux/DeepFlow_release2.0/Makefile osx/DeepFlow_release2.0/Makefile
--- linux/DeepFlow_release2.0/Makefile 2015-09-17 11:32:47.000000000 -0400
+++ osx/DeepFlow_release2.0/Makefile 2016-07-27 14:46:58.000000000 -0400
@@ -1,4 +1,4 @@
-CC=gcc
+CC=/usr/local/bin/gcc-6
CFLAGS=-Wall -g -O3 -msse4 -fPIC
LDFLAGS=-g -Wall -O3 -msse4 -fPIC
Only in osx/DeepFlow_release2.0: deepflow2.dSYM
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 1.
/places/305064,#<OSM::Node:0x007ffcf93a0658 @lon="6.6082602", @lat="36.3645192", @id=27564946, @version=1, @uid=-1, @user="Bo_hichem", @timestamp="2016-04-23T19:19:21Z", @db=nil, @tags={"admin_level"=>"8", "alt_name"=>"Qacentina", "alt_name:la"=>"Constantina", "capital"=>"4", "is_in"=>"Constantine, Constantine, Algeria", "is_in:continent"=>"Africa", "is_in:country"=>"Algeria", "is_in:country_code"=>"DZ", "name"=>"Constantine", "name:ar"=>"قسنطينة", "name:ber"=>"ⵇⵙⴻⵟⵉⵏⴰ", "name:de"=>"Constantine", "name:en"=>"Constantine", "name:es"=>"Constantina", "name:fr"=>"Constantine", "name:kab"=>"Qsemṭina", "name:la"=>"Cirta", "name:lt"=>"Konstantina", "name:ru"=>"Константина", "name:tr"=>"Konstantin", "note"=>"thank you not to change the name. tag = name merci de ne pas changer les nom . tag= name يرجى عدم تغيير الاسماء. tag= name", "place"=>"city", "population"=>"448374", "population:date"=>"2008", "ref:ONS"=>"2501", "wikipedia"=>"fr:Constantine (Algérie)"}>
/places/315233,#<OSM::Node:0x007ffcfce8af20 @lon="10.1847938
Generated for member (Columbia University) on 2014-10-01 23207 GMT l nttpzllndlhandle.nets2027lmdp.39015058604177
Public Domain,G009le-di9itized s httpzllwww.hathitrust.orqlaccess-usedtpd-qooqle
Pugna porcorum per P. Porcium [pseud] poetam.
Placentius, Jonannes, 15002-15502
Brunsviqae [typis Orpnanotropnii] 1831.
nttp = sshdl . handle . nets2027smdp . 39015058604177
diff --git classify/trainingsampleset.cpp classify/trainingsampleset.cpp
index afbf3f4..6121395 100644
--- classify/trainingsampleset.cpp
+++ classify/trainingsampleset.cpp
@@ -693,6 +693,8 @@ void TrainingSampleSet::ComputeCanonicalSamples(const IntFeatureMap& map,
fcinfo.canonical_sample = fcinfo.samples[0];
fcinfo.canonical_dist = 0.0f;
for (int i = 0; i < fcinfo.samples.size(); ++i) {
+ #pragma omp parallel
+ {
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls us/call us/call name
93.47 6.91 6.91 GenericVector<int>::operator+=(GenericVector<int> const&)
1.96 7.05 0.15 2871 50.52 50.52 GenericVector<int>::clear()
1.49 7.16 0.11 200302 0.55 0.55 frame_dummy
0.88 7.23 0.07 641 101.44 101.44 GenericVector<int>::init(int)
0.61 7.27 0.05 17608 2.56 2.56 Emalloc(int)
ryan@Lib-PAPRM02:~/mess/current!$ md5sum /usr/local/Cellar/tesseract/HEAD/share/tessdata/grc.traineddata [15:36:50]
dd42e79d6ae3a476171646e949325a35 /usr/local/Cellar/tesseract/HEAD/share/tessdata/grc.traineddata
ryan@Lib-PAPRM02:~/mess/current!$ md5sum /Users/ryan/mess/2014/48/grc/**/grc.traineddata [15:37:18]
e43ebd781c394114b8d87b881c6b8cda /Users/ryan/mess/2014/48/grc/1.0/grc.traineddata
7ee3b8a9dc8e5d8fd084c8fae888e3a7 /Users/ryan/mess/2014/48/grc/1.1/grc.traineddata
216245ccf5b1f0465c4e8a3e64dbd763 /Users/ryan/mess/2014/48/grc/1.2/grc.traineddata
b4697b098b66f3ca2fbe32efd79763d1 /Users/ryan/mess/2014/48/grc/1.3/grc.traineddata
dd42e79d6ae3a476171646e949325a35 /Users/ryan/mess/2014/48/grc/1.4/grc.traineddata
a98b1956aecf5746f4b2a54759c012d3 /Users/ryan/mess/2014/48/grc/2.0/grc.traineddata