Skip to content

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')
@fredrick
fredrick / config.txt
Created April 6, 2015 14:48
Presto VM options
View config.txt
-ea -Xmx2G -Dconfig=etc/config.properties -Dlog.levels-file=etc/log.properties -Dhive.metastore.uri=thrift://localhost:9083
@fredrick
fredrick / App-example-test.js
Last active April 6, 2018 12:39
React Router Test Context Helper
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');
});
@fredrick
fredrick / cheatsheet.R
Last active August 29, 2015 14:01
R Statistics Cheetsheet
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") +
@fredrick
fredrick / thread_last_currying.clj
Created March 11, 2014 23:39
Thread last currying
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
@fredrick
fredrick / hp35.txt
Last active December 24, 2015 00:40
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
@fredrick
fredrick / powermean.r
Last active December 16, 2015 07:48
Generalized/power mean with R
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))
}
@fredrick
fredrick / Preferences.sublime-settings
Created October 29, 2012 02:13
Sublime Text 2 Preferences
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"
}
@fredrick
fredrick / PythonBenchmark.md
Created June 8, 2012 22:27
Real World Comparison of Python Platform Performance
View PythonBenchmark.md
@fredrick
fredrick / wordpress.sql
Created May 23, 2012 01:42
WordPress Test Installation
View wordpress.sql
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `wordpress`
--
-- --------------------------------------------------------
--
-- Table structure for table `wp_commentmeta`