mkdir proj
cd proj
git init
git config user.name 'username'
r1 = {'a': {'q': 1, 'w': 2}, 'b': {'q': 3, 'w': 4}} | |
r2 = {'a': {'q': 5, 'w': 7}, 'b': {'q': 8, 'w': 2}} | |
# ret = {'a': {'q': 6, 'w': 9}, 'b': {'q': 11, 'w': 6}} | |
def iter_dict(x, y): | |
if not isinstance(x, dict): | |
return map(lambda x: sum(x), zip(x, y)) | |
if isinstance(x.values()[0], dict): | |
return dict(zip(x.keys(), map(lambda x:iter_dict(x[0], x[1]), zip(x.values(), y.values())))) | |
return dict(zip(x.keys(), iter_dict(x.values(), y.values()))) |
require 'sinatra' | |
require 'oauth' | |
API_KEY = '' | |
API_SECRET = '' | |
token = '' | |
secret = '' | |
post '/miniblog' do | |
content = params[:content] |
(function(){ | |
var output = ''; | |
for(var i = 0,array = document.querySelectorAll('.hover.filebox')[0].querySelectorAll('li'); i<array.length-1; i++){ | |
if(array[i].querySelector('input').checked && array[i].querySelector('a').href.length > 0 && array[i].querySelector('a').href.match('-----') === null){ | |
output += array[i].querySelector('a').href + '\n'; | |
} | |
} | |
copy(output); | |
})(); |
#ab -r -n 10000 http://127.0.0.1:8880/hello/world | |
#You have to run Sentry at 127.0.0.1:8000 and replace the following DSN. | |
from bottle import route, run | |
@route('/hello/:name') | |
def index(name='World'): | |
from raven import Client | |
client = Client('http://5a77e2293b2e441188dcd03180e47e6d:[email protected]:8000/2') | |
client.captureMessage('hello world!') |
var DateHelper = { | |
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time | |
// Ruby strftime: %b %d, %Y %H:%M:%S GMT | |
time_ago_in_words_with_parsing: function(from) { | |
var date = new Date; | |
date.setTime(Date.parse(from)); | |
return this.time_ago_in_words(date); | |
}, | |
time_ago_in_words: function(from) { |
#!/bin/sh -xe | |
# Sets up m2crypto on ubuntu architecture in virtualenv | |
# openssl 1.0 does not have sslv2, which is not disabled in m2crypto | |
# therefore this workaround is required | |
PATCH=" | |
--- SWIG/_ssl.i 2011-01-15 20:10:06.000000000 +0100 | |
+++ SWIG/_ssl.i 2012-06-17 17:39:05.292769292 +0200 | |
@@ -48,8 +48,10 @@ |