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
filename = File.expand_path(File.join(File.dirname(__FILE__), "erl_crash.dump")) | |
next_line = false | |
heapallocs = [] | |
counters = [] | |
File.open(filename, "r") do |crashfile| | |
while (line = crashfile.gets) | |
if (line =~ /^Stack\+heap:\s(\d)/) | |
heapallocs.push(Integer(line.split(':')[1])) | |
end | |
if (line =~ /^Program\scounter:/) |
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
var PREBIND_URL = "/http-pre-bind"; | |
var BOSH_URL = "/http-bind"; | |
var conn = new Strophe.Connection(PREBIND_URL); | |
var prebindCallback = function(status) { | |
var $status = $(status); | |
var jid = $status.find("jid").text(); | |
var sid = $status.find("body").attr("sid"); | |
var rid = parseInt($status.find("body").attr("rid"), 10)+1; | |
conn.service = BOSH_URL; |
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
%% External exports | |
-export([start_link/3, | |
init/1, | |
handle_event/3, | |
handle_sync_event/4, | |
code_change/4, | |
handle_info/3, | |
terminate/3, | |
send/2, | |
send_xml/2, |
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 env, run, sudo, local, put | |
def production(): | |
"""Defines production environment""" | |
env.user = "deploy" | |
env.hosts = ['example.com',] | |
env.base_dir = "/var/www" | |
env.app_name = "app" | |
env.domain_name = "app.example.com" | |
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name } |
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
class ApiTTests(TestCase): | |
fixtures = ['auth_views_testdata.json'] | |
def setUp(self): | |
email = "w0" | |
user = User.objects.create_user(username=email, email=email) | |
user.set_unusable_password() | |
user.jid = email | |
user.save() | |
user.apikey = get_api_key(user) | |
print "Created user: %s" % user.username |
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
talkto.com.access.log:180.194.172.72 - - [08/Apr/2013:12:03:53 +0000] "GET /media/images/static/1x1.png?js_error_log=Script+error.&url=&line=0 HTTP/1.1" 200 179 "http://workflow.talkto.com/workflow/ticket/b68fe20b-f2bd-4724-b9f6-db5219a11115/" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31" "c64895a7-85ba-4ccc-b3c0-9aea4f4f480d" "-" | |
talkto.com.access.log:110.55.5.91 - - [08/Apr/2013:12:24:47 +0000] "GET /media/images/static/1x1.png?js_error_log=Uncaught+TypeError:+Cannot+read+property+'$el'+of+undefined&url=http://talkto.com/media/min/agent-r1364744048.js&line=102 HTTP/1.1" 200 179 "http://talkto.com/workflow/ticket/c1badfcf-6fe1-45b7-888a-49e2ea9ad08f/" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31" "11858155-f7a7-4c9c-b67b-700245e86f06" "-" | |
talkto.com.access.log:121.97.142.47 - - [08/Apr/2013:13:07:02 +0000] "GET /media/images/static/1x1.png?js_error_log=TypeError:+document.activeElement.getAtt |
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
class Image | |
attr_accessor :array | |
def initialize(array) | |
@array = array | |
end | |
def blur(distance = 1) | |
distance.times do | |
transform |
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
# small recursive version | |
def collatzr(num,arr = []) | |
return arr if arr.unshift(num)[0] == 1 | |
num.even? ? collatzr(num / 2,arr) : collatzr(num * 3 + 1,arr) | |
end | |
# pretty looping version | |
def collatz(num,arr = []) | |
while num != 1 | |
arr << num | |
num = num.even? ? num / 2 : num * 3 + 1 |