Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
/** | |
* User stylesheet for Google+ https://plus.google.com | |
* | |
* @author Thomas Scholz http://toscho.de/+ | |
* @version 1.4 | |
* @browser Opera 11.5 | |
* @license MIT http://www.opensource.org/licenses/mit-license.php | |
* @description https://plus.google.com/115532307838378431827/posts/PCLQhk32gTE | |
* | |
* |
mkdir sandbox | |
curl https://gist.github.com/gists/1159290/download -o node-sandbox.tgz | |
tar zxvf node-sandbox.tgz | |
mv gist1159290*/* sandbox/ | |
rm -rf gist1159290* | |
cd sandbox |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
#!/usr/bin/python | |
''' | |
Author: Igor Maculan - n3wtron@gmail.com | |
A Simple mjpg stream http server | |
''' | |
import cv2 | |
import Image | |
import threading | |
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer | |
from SocketServer import ThreadingMixIn |
/** | |
* "Google Now" Card | |
*/ | |
body { | |
background: #e1e1e1; | |
min-height: 100%; | |
margin: auto; | |
} | |
ul.gNow { | |
width: 450px; |
#SOA Manifesto
In 2002, Jeff Bezos (CEO of Amazon), issued a mandate requiring all teams to expose their data and functionality through services interfaces. Jeff Bezos understood that in order for his company to be successful, he had to switch focus from creating a "perfect product" to creating a perfect platform for that product.
He mandated that:
public double doIt(BufferedImage image) { | |
final double skewRadians; | |
BufferedImage black = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_BYTE_BINARY); | |
final Graphics2D g = black.createGraphics(); | |
g.drawImage(image, 0, 0, null); | |
g.dispose(); | |
skewRadians = findSkew(black); | |
System.out.println(-57.295779513082320876798154814105 * skewRadians); | |
return skewRadians; |
# this forces dpkg not to call sync() after package extraction and speeds up install | |
RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup | |
# we don't need and apt cache in a container | |
RUN echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache |