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 ruby | |
# https://gist.github.com/hoanga/4955d1da5479dbff12c3eb33b9d26107 | |
# Returns a flattened version of all elements in the array. Same as Array.flatten | |
def my_flatten(arr) | |
result = [] | |
arr.each do |elem| | |
if elem.kind_of?(Array) | |
result.concat(my_flatten(elem)) |
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
FROM kterada0509/docker-revel:latest | |
EXPOSE 9000 | |
ADD . /go/src/myapp-revel | |
WORKDIR $GOPATH | |
CMD revel run myapp-revel |
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 remove_server_from_role(server, myrole) | |
save_servers = self.roles[myrole].servers.dup.map { |sss| sss.to_s } | |
self.roles[myrole].clear | |
save_servers.each do |serv| | |
unless serv == server | |
role myrole, serv | |
end | |
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
#!/bin/bash | |
SYSTEMS=$(sudo cobbler system list) | |
DOMAIN_NAME=$(cat /etc/resolv.conf | grep -E '^search' | awk ' { print $2 } ') | |
for sys in $SYSTEMS | |
do | |
IPADDRS=$(sudo cobbler system report --name=$sys | grep 'IP Address' | awk ' { print $4 } ' | sort | uniq) | |
ENTRIES="$IPADDRS $sys $sys.$DOMAIN_NAME" |
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 'rubygems' | |
require 'gdata' | |
require 'sinatra' | |
def is_gapp_user?(user, password) | |
client = GData::Client::GMail.new | |
begin | |
token = client.clientlogin(user, password) | |
return token | |
rescue GData::Client::AuthorizationError |
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/local/bin/node | |
// Program Name: watchfile.js | |
// Purpose: Monitor a set of files given on the command-line | |
// Usage: ./watchfile.js /tmp/foo /tmp/bar | |
// Output: 2009-11-25T04:50:44Z|/tmp/foo | |
var sys = require('sys'); | |
process.ARGV.forEach(function (f) { | |
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
#!/bin/sh | |
RUBY19_URL="ftp://ftp.ruby-lang.org/pub/ruby/1.9" | |
RUBY19_VERS="ruby-1.9.1-p243" | |
echo "=============================" | |
echo "Downloading and extracting..." | |
echo "=============================" | |
cd ~/Downloads && wget -c "${RUBY19_URL}/${RUBY19_VERS}.tar.gz" |
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 ruby | |
require 'net/imap' | |
require 'rubygems' | |
require 'tmail' | |
# Introduction: | |
# | |
# This small library is to archive emails from an imap server |
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
#!/bin/sh | |
# Program Name: setup-zone-exclusive.sh | |
# Author: Alain Hoang | |
# Purpose: Wrapper around setting up an ipkg branded zone with | |
# an exclusive interface | |
# Notes: If you want DHCP you will need the script from the following URL | |
# http://www.linuxtopia.org/online_books/opensolaris_2008/SYSADV3/html/extkj.html | |
# Copy that to dhcp-client-event.sh | |
# | |
# Copyright (c) 2009, Alain Hoang |
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
# Capistrano snippet | |
# Set the SSH gateway to a non standard port (22000) | |
set :gateway, 'mysshgateway.com:22000' |
NewerOlder