Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bfolkens
bfolkens / ecs-host
Last active August 11, 2016 17:25
Small utility script to emit the public ip address of an AWS ECS service
#!/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 / gputask.json
Created August 24, 2016 03:14
Task definition to run a GPU enabled task in ECS. Similar behavior to the nvidia-docker project.
{
"containerDefinitions": [
{
"memory": 2048,
"essential": true,
"mountPoints": [
{
"containerPath": "/hostlib",
"sourceVolume": "hostlib",
"readOnly": true
@bfolkens
bfolkens / fix_numpy_not_found_error.patch
Created September 16, 2016 21:36
Patch python/CMakeLists.txt to see correct version of python in multi py install with fblualib
--- 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 / fix_torch2caffe_lib_py_load_error.patch
Last active September 26, 2016 19:26
Fix load error referenced in torch2caffe issues #2, #3, and #9
--- 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 / install_nvidia_docker.sh
Created April 30, 2018 17:05
Install nvidia-docker2 for use in ECS
#
# 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 / nvidia_docker2_example_user_data.sh
Last active April 30, 2018 17:18
nvidia_docker2 example user-data script
#!/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 / ermahgerd.rb
Created July 24, 2018 04:59
ERMAHGERD!
#!/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 / ubuntu1604_caffe_hdf5.patch
Last active September 28, 2018 13:52
Fix HDF5 library paths for Caffe CMake builds
--- 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 / proc_extras.exs
Last active December 3, 2018 16:06
Elixir get memory usage by process
defmodule ProcExtras do
def list() do
Process.list()
|> Enum.map(fn (x) -> [initial_call: {c, _, _}, total_heap_size: s, message_queue_len: m] = Process.info(x, [:initial_call, :total_heap_size, :message_queue_len]); [c, x, s, m] end)
|> Enum.sort(fn [_ , _, sa, _], [_, _, sb, _] -> sa >= sb end)
|> Enum.take(20)
|> Enum.each(fn [c, x, s, m] -> IO.puts("#{inspect x}\t#{s}\t#{m}\t#{c}") end)
end
end
@bfolkens
bfolkens / tty_login.sh
Created December 19, 2018 20:35
Serial port login w/ screen
screen /dev/cu.SLAB_USBtoUART 115200 -L