Skip to content

Instantly share code, notes, and snippets.

import random
import matplotlib.pyplot as plt
import numpy as np
import functools
import time
def trunc_gauss(mu, sigma, bottom, top):
a = random.gauss(mu,sigma)
while (bottom <= a <= top) == False:
@watert
watert / UITableView.swift
Last active July 21, 2017 15:10
UITableView example in iOS Playground with XCode 6 beta
// Playground - noun: a place where people can play
import UIKit
class ViewController: UIViewController ,UITableViewDelegate, UITableViewDataSource
{
var tableView: UITableView!
var items: NSMutableArray!
override func viewDidLoad() {
super.viewDidLoad()
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 5, 2025 13:05
A badass list of frontend development resources I collected over time.
@cloudaice
cloudaice / world_location_map.json
Last active April 14, 2016 10:00
update file at utctime 2016-04-14 10:00:39.468129
{
"Taipei,Taiwan": "TW",
"Vancouver": "CA",
"SF,/,BOS,/,NYC,/,LA": "BO",
"Omaha,NE": "NE",
"China,Canton,Guangzhou": "CN",
"Arkansas": "US",
"Beijing,China": "CN",
"Waco,TX": "US",
"Ancona,Italy": "IT",
@cloudaice
cloudaice / location_map.json
Last active April 14, 2016 10:00
update file at utctime 2016-04-14 10:00:51.535982
{
"china,canton,guangzhou": "guangdong",
"shenzhen,guangdong,china": "guangdong",
"china,,\u82cf\u5dde": "jiangsu",
"peking,china": "beijing",
"pudong,district,,shanghai,,china": "shanghai",
"beijing,.china": "beijing",
"huadu,district,guangzhou,guangdong,china": "guangdong",
"beihang,university,,beijing,,china": "beijing",
"shanghai,china": "shanghai",
@wofeiwo
wofeiwo / gist:3634357
Created September 5, 2012 10:00
Golang daemonize
/* ivan(a.t)mysqlab.net */
package main
import (
"syscall"
"os"
"log"
)
func daemon(nochdir, noclose int) int {
@jankuo
jankuo / app.py
Last active October 10, 2015 02:07 — forked from wynemo/nginx.conf
tornado supervisor ubuntu12.04
# -*- coding:utf-8 -*-
import sys, os
import logging
import logging.config
import tornado
import tornado.wsgi
import tornado.httpserver
import tornado.ioloop
from tornado.options import define, options, parse_command_line
@wynemo
wynemo / nginx.conf
Created April 27, 2012 06:36
uwsgi web.py supervisor ubuntu12.04
#partial config
server {
listen 80;
server_name -;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9090;
uwsgi_param UWSGI_PYHOME /home/user/webpy_project_dir/env;
uwsgi_param UWSGI_SCRIPT wsgi;
uwsgi_param UWSGI_CHDIR /home/user/webpy_project_dir/;
@hisea
hisea / nginx
Created January 1, 2012 23:37
ubuntu passenger nginx init.d script
sudo cp nginx /etc/init.d/
sudo update-rc.d nginx defaults
sudo chmod +x /etc/init.d/nginx
/etc/init.d/nginx start
@ewheeler
ewheeler / gist:1262989
Created October 4, 2011 22:12
flask + tornado + nginx + supervisord
# create stub, then run flask app in tornado on port 5000 (perhaps with supervisord config below http://supervisord.org/index.html)
#!/usr/bin/env python
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from myflaskapp import app
http_server = HTTPServer(WSGIContainer(app))