This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# List all keys stored in memcache. | |
# Copied from: https://gist.github.com/bkimble/1365005 | |
require 'net/telnet' | |
headings = %w(id expires bytes cache_key) | |
rows = [] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Thanks to: Ahmad Azizan | |
# http://blog.lab69.com/2012/02/renaming-mp3-files-with-ruby.html | |
# You need to require this.. | |
require 'rubygems' | |
require 'mp3info' | |
# This variable will hold your first argument as directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set $is_trusted_ip false; | |
if ($http_x_forwarded_for ~ "68\.148\.96\.174") { | |
set $is_trusted_ip true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Borrowed from https://coderwall.com/p/sikrdw | |
module Vagrant | |
module Provisioners | |
class Base | |
require 'chef' | |
require 'chef/config' | |
require 'chef/knife' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
require 'multi_json' | |
Vagrant::Config.run do |config| | |
# Will load nodes/vagrant.json | |
VAGRANT_JSON = MultiJson.load(Pathname(__FILE__).dirname.join('nodes', 'vagrant.json').read) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Advcomp < Formula | |
homepage 'http://advancemame.sourceforge.net/' | |
url 'http://downloads.sourceforge.net/project/advancemame/advancecomp/1.19/advancecomp-1.19.tar.gz' | |
sha256 'd594c50c3da356aa961f75b00e958a4ed1e142c6530b42926092e46419af3047' | |
def install | |
system "./configure" | |
system "make install" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install apt-get packages: | |
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config | |
# Install chruby: | |
cd | |
wget https://github.com/downloads/postmodern/chruby/chruby-0.2.3.tar.gz | |
tar -xzvf chruby-0.2.3.tar.gz | |
cd chruby-0.2.3 | |
sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -O hab.tar.gz 'https://api.bintray.com/content/habitat/stable/linux/x86_64/hab-$latest-x86_64-linux.tar.gz?bt_package=hab-x86_64-linux' | |
tar xf hab.tar.gz | |
cd hab-0.7.0-20160614230104-x86_64-linux/ | |
sudo ./hab install core/hab | |
sudo ./hab pkg binlink core/hab hab | |
sudo useradd hab -u 42 -g 42 -d / -s /bin/sh -r | |
sudo groupadd -og 42 hab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hab studio enter | |
hab pkg export docker core/postgresql | |
hab pkg export docker core/ruby-rails-sample | |
# Terminal - 1 | |
docker run -e HAB_POSTGRESQL='initdb_superuser_password = "rails_sample"' -p 9631:9631 -p 5432:5432 -v rails_pg_data:/hab/svc/postgresql/data -it core/postgresql | |
# Terminal - 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'csv' | |
require 'json' | |
csv = CSV.parse(File.read(file_name).scrub, headers: true) | |
hash = csv.map{ |row| { code: row["Classification Code"], description: row["Classification Code Description English"] } } | |
json = hash.to_json |