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
$ sudo -i | |
# cd /dev | |
# rm random | |
# mknod /dev/random c 1 9 | |
# cat /dev/random |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 | |
# Git clone all my gists | |
import json | |
import urllib | |
from subprocess import call | |
from urllib import urlopen | |
import os | |
USER = os.environ['USER'] |
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
object Sudoku extends App { | |
val ints = (1 to 9).toSet | |
val start = List( | |
0, 0, 0, 0, 0, 0, 0, 6, 0, | |
0, 0, 0, 0, 5, 3, 0, 0, 9, | |
5, 2, 0, 0, 0, 8, 0, 1, 0, | |
0, 0, 1, 0, 6, 0, 0, 2, 4, | |
2, 0, 0, 0, 0, 0, 0, 0, 8, |
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 toQuadList()= { | |
def lrQuadsFromLine(line: List[Int], accumulator: List[List[Int]]): List[List[Int]] = { | |
if (line.length < 4) | |
accumulator | |
else | |
lrQuadsFromLine(line.tail, accumulator :+ line.slice(0, 4)) | |
} | |
data.flatMap(line => lrQuadsFromLine(line, List.empty)) | |
} |
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
url_to_ips = cloudfront_urls.collect{|url|[url,dns_servers.collect{|server| dns.resolve(server,url.host)}.flatten]}.collect{|(url,ips)| ips.collect{|ip| | |
[url.to_s,ip,Net::HTTP::start(ip,80){ |http| http.get(url.path,{"Host"=>url.host}).code}] | |
}}.flatten(1) |
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
#!/opt/csw/bin/ruby | |
# | |
# run with something like iostat -nx 10 | iostat_to_graphite.rb | |
# | |
require 'socket' | |
graphite_host='graphite' | |
graphite_port=2003 |
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
#!/opt/csw/bin/ruby | |
# | |
# | |
require 'socket' | |
def normalize_size(size) | |
multiples={'K' => (1024), | |
'M' => (1024 * 1024), | |
'G' => (1024 * 1024 * 1024), | |
'T' => (1024 * 1024 *1024 *1024) |
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
use Net::StatsD::Client; | |
use strict; | |
my $client = Net::StatsD::Client->new(host=>"your-statsd-host-here"); | |
while(<>){ | |
my ($host,$service,$perfdata) = split(/~/); | |
$host =~ s/\./-/g; | |
$service =~ s/ /_/g ; | |
my $prefix= "nagios." . $host . "." . $service; |
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
git diff --cached --name-status | while read st file; do | |
# skip deleted files | |
if [ "$st" == 'D' ]; then continue; fi | |
# do a check only on the puppet files | |
if [[ "$file" =~ ".pp" ]]· | |
then | |
echo "syntax checking \"$file\""· | |
if ! puppet --confdir=/tmp --vardir=/tmp --parseonly --ignoreimport "$file" | |
then | |
echo "puppet syntax check failed for file: $file" |