Skip to content

Instantly share code, notes, and snippets.

View abelsonlive's full-sized avatar
🕳️
[ o o ]

Brian Abelson abelsonlive

🕳️
[ o o ]
View GitHub Profile
@abelsonlive
abelsonlive / try_or_die.sh
Created January 17, 2017 23:17 — forked from dotike/try_or_die.sh
3 finger claw technique for POSIX shell programming. Three one-line functions which greatly enhance shell programming, enabling reliable UNIX-style programming in an extremely concise fashion.
#!/bin/sh
##############################################################################
# This code known is distributed under the following terms:
#
# Copyright (c) 2013 Isaac (.ike) Levy <ike@blackskyresearch.net>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions

Performance of Flask, Tornado, GEvent, and their combinations

Wensheng Wang, 10/1/11

Source: http://blog.wensheng.org/2011/10/performance-of-flask-tornado-gevent-and.html

When choosing a web framework, I pretty much have eyes set on Tornado. But I heard good things about Flask and Gevent. So I tested the performance of each and combinations of the three. I chose something just a little more advanced than a "Hello World" program to write - one that use templates. Here are the codes:

1, Pure Flask (pure_flask.py)

#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
#
# retrieved from: http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
#
@abelsonlive
abelsonlive / kMeansPP.R
Created November 29, 2012 15:29 — forked from dsparks/kMeansPP.R
k-Means ++ center initialization algorithm
toInstall <- c("proxy")
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# kmeans++ center initialization algorithm
kMeansPP <- function(df, k, doPlot = TRUE){
kCenters <- data.frame(matrix(NA, ncol = ncol(df), nrow = k))
whichPoints <- rep(NA, k)
whichPoints[1] <- sample(1:nrow(df), 1)
kCenters[1, ] <- df[whichPoints[1], ] # Initial center
@abelsonlive
abelsonlive / gist:4090899
Created November 16, 2012 21:04 — forked from brianboyer/gist:1696819
Lion dev environment notes
@abelsonlive
abelsonlive / file_three.rb
Created October 26, 2012 20:11 — forked from maliabadi/file_three.rb
requiring gems
# this feels weird, but there's some magic here. Ruby knows where 'rubygems' is without you having to explain it with an exact path.
require 'rubygems'
# now you can you just flat-out require ANY gem you have installed! like
require 'pony'
# all of the sudden you have this really cool ruby library called 'pony' in your application's object space! And you can do shit like this:
Pony.mail({
:to => 'matt@cutt.com',
@abelsonlive
abelsonlive / Makefile
Created October 25, 2012 23:16 — forked from even4void/Makefile
A sample demo of R Markdown with pandoc
RMDFILE=demo-rmd-pandoc
PANDOC=~/.cabal/bin/pandoc
all:
Rscript -e "require(knitr); require(markdown); knit('$(RMDFILE).rmd', '$(RMDFILE).md'); purl('$(RMDFILE).rmd')"
${PANDOC} --mathjax --toc -B header.html -A footer.html --bibliography refs.bib --css markdown.css -s $(RMDFILE).md -o $(RMDFILE).html
@abelsonlive
abelsonlive / raster_scatter.R
Created October 16, 2012 22:10 — forked from dsparks/raster_scatter.R
Drawing a scatter plot of raster images
# Drawing a scatter plot of raster images
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("png", "devtools", "MASS", "RCurl")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Some helper functions, lineFinder and makeTable
source_gist("818983")
source_gist("818986")
@abelsonlive
abelsonlive / r_install.sh
Created October 4, 2012 15:04 — forked from seeRead/r_install.sh
r init file
#/bin/bash
# run chmod +x THIS_GIST.sh
# configure for debian or ubuntu! debian has dependencies that ubuntu's libs will conflict with
# sources:
# http://cran.r-project.org/bin/linux/debian/
# http://cran.r-project.org/bin/linux/ubuntu/README
# http://stackoverflow.com/questions/10255082/installing-r-from-cran-ubuntu-repository-no-public-key-error
clear
find: ([a-z]) (["])([a-z])
replace: $1 \\$2$3
find: .""
replace: ./""
find: ([a-z])(["]) ([a-z])
replace: $1\\$2 $3