This file contains 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 -eu | |
# | |
# Color log4j-style logs for easier visual parsing. | |
# | |
# Usage: | |
# tail foo.log | log-color | |
# run-service | log-color | |
black="` tput setaf 0; tput bold`" | |
red="` tput setaf 1; tput bold`" |
This file contains 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
ubuntu@ip-10-72-38-138:~$ sudo -u xncore lsof -p 18990 | cut -c72- | sort|uniq -c | sort -n | |
1 / | |
1 *:17071 (LISTEN) | |
1 *:44059 (LISTEN) | |
1 *:50343 (LISTEN) | |
1 anon_inode | |
1 /dev/null | |
1 /dev/random | |
1 /dev/urandom | |
1 *:http-alt (LISTEN) |
This file contains 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 fabric.api import * | |
from fabric.colors import green as _green, yellow as _yellow | |
import boto | |
import boto.ec2 | |
from config import * | |
import time | |
def create_server(): | |
""" | |
Creates EC2 Instance |
This file contains 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 | |
exec ~/src/scala/bin/scala -savecompiled "$0" "$@" | |
!# | |
// Example of object algebras, based on the scala example at http://ropas.snu.ac.kr/~bruno/oa/ | |
// type Term = ∀A,O. O[A] -> A | |
trait Term[O[_]] { | |
def apply[A](o: O[A]): A | |
} |
This file contains 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
import java.io.IOException; | |
import java.lang.management.ManagementFactory; | |
import java.util.Set; | |
import javax.management.MBeanServer; | |
import javax.management.ObjectName; | |
/** | |
* Print the Collector used in the program. | |
* @author khotyn |
This file contains 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
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_21). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> import shapeless._ | |
import shapeless._ | |
scala> import syntax.tuple._ | |
import syntax.tuple._ |
This file contains 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 'sinatra' | |
require 'json' | |
class GitHubUpdater | |
def self.update?(json) | |
(JSON.parse(json)["ref"] == "refs/heads/master") | |
end |
This file contains 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
import sys, types | |
def module(cls): | |
''' | |
Compose modules via class inheritance. | |
Construct a module from a singleton object from the given class `cls`, and | |
then replace cls's enclosing, top-level, file-based module with the newly | |
constructed class-based module. Retain a reference `_cls` to the original | |
class to allow extension via class inheritance. |
This file contains 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
implicit class AnyOps[X](x: X) { | |
def withEffect (f: X => Unit) : X = { f(x); x } | |
def into[Y] (f: X => Y) : Y = f(x) | |
} | |
// Example usage: | |
def lifeTheUniverseAndEverything = 42 withEffect { x => | |
log.debug("Someone asked 'the question' again, I told them %s", x) | |
meter("req.lifeTheUniverseAndEverything") += 1 |
This file contains 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 | |
# | |
# Set names on unnamed EBS volumes from their attached EC2 instance. | |
# | |
# Requires: | |
# - aws: https://github.com/aws/aws-cli (tested with aws-1.0.0) | |
# - jq: http://stedolan.github.io/jq/ (tested with jq-1.3) | |
import os, sys, json, subprocess |
OlderNewer