Instantly share code, notes, and snippets.

View run_survival.py
%matplotlib inline
import numpy as np
from lifelines import KaplanMeierFitter
from matplotlib import pyplot as plt
from pylab import rcParams
rcParams['figure.figsize'] = 20, 10
plt.style.use('ggplot')
View config.txt
-ea -Xmx2G -Dconfig=etc/config.properties -Dlog.levels-file=etc/log.properties -Dhive.metastore.uri=thrift://localhost:9083
View App-example-test.js
var React = require('react/addons'),
TestUtils = React.addons.TestUtils,
TestContext = require('./TestContext'),
App = require('./App.jsx'),
app = TestContext.getRouterComponent(App);
describe('App', function() {
it('has something', function() {
expect(app.getDOMNode().textContent).toContain('something');
});
View cheatsheet.R
library(ggplot2)
library(plyr)
## Graphing
# Histogram of columnName in someDataFrame, ordered in descending frequency
# from left to right.
ggplot(someDataFrame, aes(x=reorder(columnName,columnName,function(x)-length(x)))) +
geom_bar() +
xlab("X Label") +
View thread_last_currying.clj
;;
;; Example of thread last macro ->> and partial function application
;;
(defn header [this] {:head this})
(->> (header 1) :head ((partial + 1)))
;; => 2
(->> (header 3) :head ((partial - 1)))
;; => -2
View hp35.txt
7 7
~:,,:~
7 +:,.~~~~~~:~7
777777 7~:.?7~~~~~~~~~,:+7
77 777 7 7 77~,.:,,:..7~~~~~~~~~.:7
7777777777777777777 77~:,7,:~::::,:..~~:~~~~~~~,:7 7
7777777777777777777777 777 7 77~:.7::::.:~:::..:::?~~~~~~~~~~,~7 7
777777777777777777777777777777777:,=,:::?::::..:~::,~::,.7~~~~~~~~~~,~77
77777777777777777777777777777::.7::~::~:...~:::.~?,::::::,.7~~~~~~~~~~,~ 7777777
77777777777777777777777777:.~,::::.:~,~:::,~~:::..:~~::::::..+~~~~~~~~~,,~777777
View powermean.r
# Power mean
## Examples:
## p = 1, arithmetic mean
## p = 2, quadratic mean (RMS)
pmean <- function(x, p) {
library(TTR)
return(tail(TTR::SMA(x^p, length(x))^(1/p), n=1))
}
View Preferences.sublime-settings
{
"color_scheme": "Packages/User/Monokai Soda.tmTheme",
"ensure_newline_at_eof_on_save": true,
"translate_tabs_to_spaces": true,
"font_face": "Monaco",
"font_size": 12,
"theme": "Soda Light.sublime-theme"
}
View PythonBenchmark.md

Real World Comparison of Python Platform Performance

Data parsing benchmark, using homogeneous Python source code across all platforms with the exception of, for Cython, type annotation and compilation to C. CPython 2.7.2 invoked with python, Cython 0.16 with python with test script loading compiled module, and PyPy 1.9 with pypy.

wc data.log
  21768456  360606156 3563967905 data.log
View wordpress.sql
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `wordpress`
--
-- --------------------------------------------------------
--
-- Table structure for table `wp_commentmeta`