This file contains hidden or 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 bash | |
# | |
# Usage: | |
# download.sh URL DEST MD5 | |
# | |
# Example: | |
# download.sh \ | |
# http://a.mbbsindia.com/hbase/1.1.3/hbase-1.1.3-bin.tar.gz \ | |
# /var/downloads/cache/1c9f52d89cf665ef35f101cb8f2b57e4 \ | |
# 1c9f52d89cf665ef35f101cb8f2b57e4 |
This file contains hidden or 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
def configure_caching(config) | |
if Vagrant.has_plugin?('vagrant-cachier') | |
config.cache.scope = :box | |
config.cache.enable :generic, { :cache_dir => "/var/downloads/cache" } | |
end | |
end | |
Vagrant.configure('2') do |config| |
This file contains hidden or 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
-module(pad_binary). | |
% http://erlang.org/pipermail/erlang-questions/2008-December/040709.html | |
-spec pad_binary_to(WidthInBytes :: pos_integer(), Raw :: binary()) -> | |
Padded :: binary(). | |
pad_binary_to(WidthInBytes, Raw) -> | |
case (WidthInBytes - size(Raw) rem WidthInBytes) rem WidthInBytes of | |
0 -> Raw; | |
N -> <<Raw/binary, 0:(N*8)>> | |
end. |
This file contains hidden or 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 bash | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
is_xcode_cli_tools_installed() { | |
xcode-select -p >/dev/null 2>&1 | |
[[ $? -eq 0 ]] | |
} |
This file contains hidden or 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 bash | |
# redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -euo pipefail | |
IFS=$'\n\t' | |
# `set` is safer than relying on a hashbang like `#!/bin/bash -e` | |
# because that is neutralized when someone runs the script as `bash script.sh` | |
# Exit on error. Append `|| true` if we expect an error. | |
# set -o errexit |
This file contains hidden or 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 python | |
import argparse | |
import json | |
import re | |
import subprocess | |
import sys | |
def ssh_config_lookup(key, config_text): | |
return re.search("(({})\s+(.*))".format(key), config_text).group(3) |
This file contains hidden or 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
# Create an OSX Vagrant Box | |
# Run this script from the directory that has InstallESD.dmg in it | |
# Get InstallESD.dmg using the method described on this link | |
# http://hints.macworld.com/article.php?story=20110831105634716 | |
# Setup a vagrant box | |
# http://garylarizza.com/blog/2013/01/20/using-veewee-to-build-os-x-vms/ | |
git clone git://github.com/jedi4ever/veewee.git |
This file contains hidden or 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 'base64' | |
# tools.ietf.org/html/rfc2397 | |
# developer.mozilla.org/en/data_URIs | |
# "data:" + MIME type + ";base64," + base64-encoded content | |
def to_data_url(content, content_type) | |
outuri = 'data:' + content_type + ';base64' | |
content = Base64.encode64(content).gsub("\n", '') | |
outuri += ",#{content}" |
This file contains hidden or 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
# tools.ietf.org/html/rfc2397 | |
# developer.mozilla.org/en/data_URIs | |
require 'base64' | |
require 'cgi' | |
# based on segment7.net/projects/ruby/datafy | |
def to_datauri(content, content_type) | |
outuri = 'data:' + content_type | |
unless content_type =~ /^text/i # base64 encode if not text |
This file contains hidden or 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
<!DOCTYPE html> | |
<!--[if lt IE 7]><html class="lt-ie9 lt-ie8 lt-ie7" lang="en"><![endif]--> | |
<!--[if IE 7]><html class="lt-ie9 lt-ie8" lang="en"><![endif]--> | |
<!--[if IE 8]><html class="lt-ie9" lang="en"><![endif]--> | |
<!--[if gt IE 8]><!--><html lang="en"><!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Box</title> | |
<style> |