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 'set' %> | |
<% require 'yaml' %> | |
<% @config = YAML.load_file(config) %> | |
job "<%= @config['job'] %>" { | |
datacenters = [ | |
<% @config['datacenters'].each do |datacenter| %> | |
"<%= datacenter %>", | |
<% 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
In [1]: class Foo(object): | |
...: def curry(self, x): | |
...: return x | |
In [2]: f = Foo() | |
In [3]: def callee(func, arg): | |
...: return func(arg) | |
In [4]: callee(f.curry, "1") | |
Out[4]: '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
import SimpleHTTPServer | |
import SocketServer | |
PORT = 1238 | |
class SimpleHTTPRequestHandler(SimpleHTTPServer.BaseHTTPServer.BaseHTTPRequestHandler): | |
def do_PUT(self): | |
data = self.rfile.read() | |
with open('recv.pcap', 'w+') as f: | |
f.write(data) |
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
import pdb | |
import sys | |
import time | |
def main(): | |
now = time.time() | |
num = int(sys.argv[1]) | |
for i in xrange(0, num): | |
exec("name%d = 0" % i) | |
end = time.time() |
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 | |
GIT_SERVER="git.example.com" | |
SVN_SERVER="svn.example.com" | |
RETURN_OK=0 | |
RETURN_SKIP=1 | |
RETURN_ERROR=2 | |
# ############# # |
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
#include <iostream> | |
class Hello { | |
public: | |
virtual std::string hello() =0; | |
}; | |
template <typename... Extensions> | |
class MyClass : public Extensions... { | |
}; |
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 Irssi; | |
use POSIX; | |
use vars qw($VERSION %IRSSI); | |
use HTML::Parser; | |
use warnings; | |
use strict; | |
my $VERSION = "0.01"; | |
my %IRSSI = ( |
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
prev_cols = 0 | |
puts "" | |
loop do | |
cols = `tput cols`.chomp.to_i | |
if prev_cols <= cols | |
print "\e[1A\e[2K" | |
print "="*prev_cols | |
puts "\r" | |
prev_cols += 1 |