Skip to content

Instantly share code, notes, and snippets.

Zohaib Sibte Hassan maxpert

Block or report user

Report or block maxpert

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View multiprocessing-helloworld.py
http://stackoverflow.com/questions/4073092/errno-9-using-the-multiprocessing-module-with-tornado-in-python
p = multiprocessing.Pool(4)
class QueryHandler(tornado.web.RequestHandler):
...
@tornado.web.asynchronous
def get(self):
...
p.apply_async(async_func, [sql_command, arg1, arg2, arg3, ],
callback_func)
@headius
headius / gist:1408381
Created Nov 30, 2011
JRuby Fiber perf compared to 1.9.3
View gist:1408381
# Ruby 1.9.3
ruby-1.9.3-p0 ~/projects/jruby $ ruby -v bench/bench_fiber_ring.rb 5 100 1000
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]
bench/bench_fiber_ring.rb:23: warning: mismatched indentations at 'end' with 'def' at 21
100 fibers / 1000 passes: 0.150000 0.000000 0.150000 ( 0.155022)
100 fibers / 1000 passes: 0.150000 0.000000 0.150000 ( 0.153985)
100 fibers / 1000 passes: 0.150000 0.000000 0.150000 ( 0.153822)
100 fibers / 1000 passes: 0.150000 0.000000 0.150000 ( 0.152370)
100 fibers / 1000 passes: 0.160000 0.000000 0.160000 ( 0.155857)
@maxpert
maxpert / Femto.js
Created May 24, 2011
Femto JS Templating
View Femto.js
/**
The MIT License
Copyright (c) 2010 Zohaib Sibt-e-Hassan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
View system_tuning.sh
#!/bin/bash
# file descriptor
# Change 400000 to increase or decrease number of file descriptor
echo "* soft nofile 400000" >> /etc/security/limits.conf
echo "* hard nofile 400000" >> /etc/security/limits.conf
# Changing kernal parameters (modify value if required)
@plugnburn
plugnburn / README.md
Last active Jun 1, 2018
XT.js - DOM construction / templating library in 18 lines of JS, 323 bytes minified
View README.md

XT.js

Let's close the ultra-small library cycle with some awesome array-based templating. 323 bytes minified.

How to obtain

Just download the minified version here or include it into your code:

@mwunsch
mwunsch / avatar.sh
Last active Jun 23, 2018
Random Avatar Generator
View avatar.sh
curl -s 'http://realbusinessmen.tumblr.com/api/read?type=photo&num=50' | ruby -r'rexml/document' -e 'puts REXML::Document.new(STDIN).elements["tumblr/posts"].to_a.shuffle.pop.map(&:text)'
@manishtpatel
manishtpatel / main.go
Last active Oct 3, 2019
GoLang Encrypt string to base64 and vice versa using AES encryption.
View main.go
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)
View my_thoughts_on_msgpack.md

My thoughts on MessagePack

Hi. My name is Sadayuki "Sada" Furuhashi. I am the author of the MessagePack serialization format as well as its implementation in C/C++/Ruby.

Recently, MessagePack made it to the front page of Hacker News with this blog entry by Olaf, the creator of the Facebook game ZeroPilot. In the comment thread, there were several criticisms for the blog post as well as MessagePack itself, and I thought this was a good opportunity for me to address the questions and share my thoughts.

My high-level response to the comments

To the best of my understanding, roughly speaking, the criticisms fell into the following two categories.

View summary_tool.py
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@jlong
jlong / uri.js
Created Apr 20, 2012
URI Parsing with Javascript
View uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
You can’t perform that action at this time.