Skip to content

Instantly share code, notes, and snippets.

Brad Folkens bfolkens

Block or report user

Report or block bfolkens

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ermahgerd.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'ermahgerd'
require 'yaml'
require 'awesome_print'
def deep_derp(h)
Marshal.load(Marshal.dump(h))
end
@bfolkens
bfolkens / nvidia_docker2_example_user_data.sh
Last active Apr 30, 2018
nvidia_docker2 example user-data script
View nvidia_docker2_example_user_data.sh
#!/bin/bash
CLUSTER_NAME=[your-cluster-name]
echo ECS_CLUSTER=${CLUSTER_NAME} >> /etc/ecs/ecs.config
#
# Install NVIDIA CUDA & friends
# (remove section if using an image with drivers pre-installed)
#
@bfolkens
bfolkens / install_nvidia_docker.sh
Created Apr 30, 2018
Install nvidia-docker2 for use in ECS
View install_nvidia_docker.sh
#
# Install nvidia-docker2
#
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
apt-get update
apt-get -qq install -y nvidia-docker2
@bfolkens
bfolkens / ubuntu1604_caffe_hdf5.patch
Last active Sep 28, 2018
Fix HDF5 library paths for Caffe CMake builds
View ubuntu1604_caffe_hdf5.patch
--- cmake/Dependencies.cmake- 2017-05-28 18:15:46.026060196 +0000
+++ cmake/Dependencies.cmake 2017-05-28 18:16:36.542061070 +0000
@@ -43,9 +43,9 @@
include(cmake/ProtoBuf.cmake)
# ---[ HDF5
-find_package(HDF5 COMPONENTS HL REQUIRED)
-list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${HDF5_INCLUDE_DIRS})
-list(APPEND Caffe_LINKER_LIBS PUBLIC ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
+#find_package(HDF5 COMPONENTS HL REQUIRED)
@bfolkens
bfolkens / fix_torch2caffe_lib_py_load_error.patch
Last active Sep 26, 2016
Fix load error referenced in torch2caffe issues #2, #3, and #9
View fix_torch2caffe_lib_py_load_error.patch
--- th.orig 2016-09-24 19:36:08.010747479 +0000
+++ th 2016-09-24 19:37:27.945031931 +0000
@@ -1,3 +1,3 @@
#!/bin/sh
-exec '/root/torch/install/bin/luajit' -e 'package.path="/root/.luarocks/share/lua/5.1/?.lua;/root/.luarocks/share/lua/5.1/?/init.lua;/root/torch/install/share/lua/5.1/?.lua;/root/torch/install/share/lua/5.1/?/init.lua;"..package.path; package.cpath="/root/.luarocks/lib/lua/5.1/?.so;/root/torch/install/lib/lua/5.1/?.so;"..package.cpath' -e 'local k,l,_=pcall(require,"luarocks.loader") _=k and l.add_context("trepl","scm-1")' '/root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th' "$@"
+LD_PRELOAD=/usr/lib/libcaffe.so PYTHONPATH=/usr/lib/python2.7:/usr/local/lib/python2.7:/usr/local/src/fb-caffe-exts:/usr/python exec '/root/torch/install/bin/luajit' -e 'package.path="/root/.luarocks/share/lua/5.1/?.lua;/root/.luarocks/share/lua/5.1/?/init.lua;/root/torch/install/share/lua/5.1/?.lua;/root/torch/install/share/lua/5.1/?/init.lua;"..package.path; package.cpath="/root/.luarocks/lib/lua/5.1
@bfolkens
bfolkens / fix_numpy_not_found_error.patch
Created Sep 16, 2016
Patch python/CMakeLists.txt to see correct version of python in multi py install with fblualib
View fix_numpy_not_found_error.patch
--- python/CMakeLists.txt.old 2016-09-16 21:33:29.181708736 +0000
+++ python/CMakeLists.txt 2016-09-16 21:33:50.121273080 +0000
@@ -26,7 +26,6 @@
FIND_PACKAGE(THPP REQUIRED)
FIND_PACKAGE(FBLuaLib REQUIRED)
FIND_PACKAGE(PythonLibs REQUIRED)
-FIND_PACKAGE(NumPy REQUIRED)
if (${PYTHONLIBS_VERSION_STRING} GREATER "3" )
message(STATUS "Found Python version > 3, linking against 2.7")
@bfolkens
bfolkens / gputask.json
Created Aug 24, 2016
Task definition to run a GPU enabled task in ECS. Similar behavior to the nvidia-docker project.
View gputask.json
{
"containerDefinitions": [
{
"memory": 2048,
"essential": true,
"mountPoints": [
{
"containerPath": "/hostlib",
"sourceVolume": "hostlib",
"readOnly": true
@bfolkens
bfolkens / ecs-host
Last active Aug 11, 2016
Small utility script to emit the public ip address of an AWS ECS service
View ecs-host
#!/bin/bash
#
# Usage: ./ecs-host profile-name cluster-name service-name
#
display_usage() {
echo "Retrieve ip address for service name."
echo -e "\nusage: `basename $0` profile-name cluster-name service-name"
}
@bfolkens
bfolkens / retrieve.js
Last active Dec 9, 2015
Retrieve image response from server
View retrieve.js
var key = 'YOUR API KEY';
var token = 'THE TOKEN FROM THE REQUEST RESPONSE';
var poll = function() {
$.ajax({
'async': true,
'crossDomain': true,
'url': 'https://api.cloudsightapi.com/image_responses/' + token,
'method': 'GET',
'headers': {
View gist:7f27b42d2ec1f28ccf3b
#!/usr/bin/env ruby
require 'open-uri'
require 'csv'
CSV.open('infile.csv') do |csv|
csv.each do |row|
url = row[0]
open(url) do |infile|
rootname = File.basename(url)
You can’t perform that action at this time.