Skip to content

Instantly share code, notes, and snippets.

View codatory's full-sized avatar

Alex Conner codatory

View GitHub Profile
========================================================================
BYTE UNIX Benchmarks (Version 5.1.3)
System: apocalypse.codatory.com: GNU/Linux
OS: GNU/Linux -- 2.6.32-5-amd64 -- #1 SMP Fri May 10 08:43:19 UTC 2013
Machine: x86_64 (unknown)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: Intel(R) Xeon(R) CPU L5420 @ 2.50GHz (5000.4 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
CPU 1: Intel(R) Xeon(R) CPU L5420 @ 2.50GHz (5000.2 bogomips)
@codatory
codatory / decide.rb
Created June 26, 2013 15:13
Decision making made easy
def make_decision(&block)
raw = (0..9).map{ block.call }
freq = raw.inject(Hash.new(0)) { |h,v| h[v] += 1; h }
raw.sort_by { |v| freq[v] }.last
end
@codatory
codatory / pointlinux-install.sh
Created June 19, 2013 17:30
Script to install Chrome, Dropbox and Virtualbox on Point Linux
#!/bin/bash
if [[ `whoami` != 'root' ]]; then
echo 'You must run this script with Root permissions.'
exit
fi
apt-get update
apt-get upgrade -y
apt-get install pointlinux-repos-nonfree
@codatory
codatory / ubuntu.sh
Last active December 16, 2015 04:19
Ubuntu 12.04 setup
#!/bin/bash
if [[ `whoami` != 'root' ]]; then
echo 'You must run this script with Root permissions.'
exit
fi
set -E
set -o vi
#!/bin/bash
# Random sleep up to 55 minutes - so all my VPSes don't back up at the same time and I don't have to manually manage distribution in CRON
sleep $(($RANDOM / 10))
export PASSPHRASE='SuperSecretPassphrase'
# Export backup location variable
backup_location="/home/backups/`hostname`/duplicity"
namespace :import do
desc 'Imports ZipCodes from geonames.org'
task :zip_codes do
require 'zip/zip'
require Rails.root.join('config/environment.rb')
ZIPFILE = Rails.root.join('tmp/zipcodes.zip')
CSV_OPTS = {col_sep: "\t", headers: [:country_code, :postal_code, :place_name, :state_name, :state_code, :county_name, :county_code, :community_name, :community_code, :lattitude, :longitude, :accuracy]}
if !File.exist?(ZIPFILE)
@codatory
codatory / chicagovps.txt
Last active December 13, 2015 23:19
Cheap VPS Benchmarks
ChicagoVPS 2048 MB VPS
$40 /year (special)
Cachefly 100 MB Download: 3.36M/s in 30s
========================================================================
BYTE UNIX Benchmarks (Version 5.1.3)
System: rails: GNU/Linux
OS: GNU/Linux -- 2.6.32-042stab062.2 -- #1 SMP Wed Oct 10 18:28:35 MSK 2012
FOr b3 w1ll pR0dUc+, c@ch3d 3n4b|3d, 83 w1t. WI5h 34513r (4(h3d 0R +HE, 15 m1t3 pr3f3|23nc35 n0w, 1T 8@d \/\/3b.
@codatory
codatory / stlib_loader.rb
Created January 9, 2013 15:35
require most of Ruby 1.9's standard library
libs = Dir.glob("#{ENV['MY_RUBY_HOME']}/lib/ruby/1.9.1/*.rb").map{|i| i.split('/').last.split('.').first}
libs.reject!{|i| i == 'debug'}
libs.reject!{|i| i =~ /tk/}
libs.reject!{|i| i =~ /^[A-Z]/}
libs.each do |lib|
puts "Loading #{lib}"
require lib
end
#!/bin/bash
SERVERS=( 8.8.8.8 8.8.4.4 209.244.0.3 209.244.0.4 )
for server in ${SERVERS[@]}; do
date -u "+%Y-%m-%d %H:%M UTC : Testing $server"
mtr -lrwc 20 -o 'LDRS NBAW V JMXI' $server
done