Skip to content

Instantly share code, notes, and snippets.

View elebertus's full-sized avatar

elebertus elebertus

View GitHub Profile
>> foo = [ "bar" ]
=> ["bar"]
>> foo |= [ "baz" ]
=> ["bar", "baz"]
@elebertus
elebertus / gist:84bd1daf9b916a74a63a
Created March 25, 2015 22:11
Workaround for go cent 5.x kernel 2.6.18-238.el5 vDSO gettimeofday
# Patch the Go runtime package to disable vDSO support for gettimeofday and clock_gettime in order to make compiled Go applications compatible with the buggy CentOS 5.6 kernel: 2.6.18-238.el5
sed -i 's/nelem(sym_keys)/1/g' /usr/local/go/src/runtime/vdso_linux_amd64.c
# Rebuild go
usr/local/go/src/make.bash
# Rebuild your binary
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Sample Amazon Linux x86_64 using CloudFormation",
"Parameters" : {
"KeyName" : {
"Description" : "some-key",
"Type" : "String"
#!/usr/bin/env perl
# -*- perl -*-
# location of the server-side scp we want to run
$scp_server = "/usr/bin/scp";
sub fail {
my ($msg) = @_;
print STDERR $msg, "\n";
exit 1;
yum erase $(yum list installed | grep ruby | awk '{printf $1" "}' | sed -e 's/libselinux-ruby.x86_64//g' -e 's/\.x86_64//g') && cd /tmp ; curl -O http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz && tar xzf ruby-1.9.2-p290.tar.gz && cd ruby-1.9.2-p290 && ./configure && make && make install && gem i chef && wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm && rpm -i epel-release-6-5.noarch.rpm && mkdir /var/cache/chef ; mkdir /var/cache/chef/cookbooks
# Up the kernel's SHMMAX
raisit = execute "raise_tha_roof" do
if ["t1.micro","c1.medium","m1.small"].include? node[:ec2][:instance_type] then
shmmax=1073741824
else
shmmax=17179869184
end
command "sysctl -w kernel.shmmax=#{shmmax}"
end
function prompt {
local bc="\[\e[0m\]"
local ob="\[\e[1;31m\][\]"
local cb="\[\e[1;31m\]]\]"
local spc="\[\e[0;32m\]"
local host="\[\e[30;34m\]\u@\h\]"
local lwd="\[\e[30;34m\]\w\]"
export PS1="$ob"$bc"$host"$bc"$cb"$bc"$spc:$ob"$bc"$lwd"$bc"$cb"$bc""$spc"$"$bc" "
}
prompt
foo = node[:ntp][:test]
template "foo.conf" do
source "foo.conf.erb"
variables( :foobar => foo[:platform])
end
action :start_stop do
begin
@new_resource.start_service(node[:service_status][:state])
rescue
Chef::Log.warn("----------")
Chef::Log.warn("Application default state is missing. Defaulting to start the service. If this cluster or service should not automatically start defined node[:service_status][:state]")
Chef::Log.warn("----------")
@new_resource.start_service("start")
@new_resource.env_state("start")
# LAX -> linode
[root@eblack-vagrant01 mtr-0.82]# mtr brofist.net --report-cycles 30 --report
HOST: eblack-vagrant01 Loss% Snt Last Avg Best Wrst StDev
1.|-- 10.0.2.2 0.0% 30 0.4 2.1 0.2 42.3 7.7
2.|-- 1-1-12-12.attalascom.net 0.0% 30 4.2 3.1 1.1 32.5 5.7
3.|-- cpe-76-173-0-1.socal.res. 0.0% 30 33.9 33.9 22.9 62.2 8.9
4.|-- tge7-1.wlvgcabn-cer02.soc 0.0% 30 17.6 15.5 11.5 32.5 5.0
5.|-- tge0-8-0-8.vnnycajz-ccr01 3.3% 30 23.5 27.4 18.5 78.6 13.1
6.|-- 72.129.13.0 0.0% 30 19.0 25.1 17.5 51.9 7.6
7.|-- 107.14.19.32 0.0% 30 21.6 24.3 16.7 52.7 7.0