Skip to content

Instantly share code, notes, and snippets.

View huyng's full-sized avatar

Huy Nguyen huyng

View GitHub Profile
@huyng
huyng / reflect.py
Created February 7, 2011 17:57
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@huyng
huyng / matplotlibrc
Created February 8, 2011 15:50
my default matplotlib settings
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
@huyng
huyng / dabblet.css
Created December 9, 2012 06:20
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
* { margin:0px; padding:0px;}
html {
background: linear-gradient(45deg, #000, #202024 );
min-height: 100%;
@huyng
huyng / .numpy-site.cfg
Last active March 14, 2017 19:36
Place the following in your home directory at ~/.numpy-site.cfg in order to install numpy with openblas support
# Place the following in your home directory at ~/.numpy-site.cfg
# in order to install numpy with openblas support
[openblas]
libraries = openblas
library_dirs = /usr/local/opt/openblas/lib
include_dirs = /usr/local/opt/openblas/include
@huyng
huyng / gist:8447087
Created January 15, 2014 23:46
Timings for load_bundle
Line # Hits Time Per Hit % Time Line Contents
==============================================================
25 def load_bundle(bundle_dir):
26 """
27 Load and return a bundle object from its path.
28 The class of the returned bundle will be introspected
29 from the bundle metadata.
30
31 This is the preferred method of de-serializing bundles.
@huyng
huyng / index.html
Last active August 29, 2015 13:56
world map and events
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
stroke: white;
stroke-width: 0.25px;
fill: grey;
}
svg {
margin:40px auto;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Nano buildr</title>
<link href="/static/bower_components/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
@huyng
huyng / opencv_resize.cpp
Created March 18, 2014 20:30
Opencv resize
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
// using namespace cv;
int main(int argc, char const *argv[])
{
cv::Mat src, dst;
strawberry
-> no show
-> strawberry, fruit, food
street
-> show
streetcar
-> noshow
-> streetcar, tram, transportation
stringed instrument
-> noshow
18 the
10 of
8 a
7 to
5 were
5 by
5 North
5 Korean
4 troops
4 U.S.