Skip to content

Instantly share code, notes, and snippets.

Fredrick Galoso fredrick

Block or report user

Report or block fredrick

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 Apr 6, 2015
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 Apr 6, 2018
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 Aug 29, 2015
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") +
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
@fredrick
fredrick / powermean.r
Last active Dec 16, 2015
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))
}
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 Jun 8, 2012
Real World Comparison of Python Platform Performance
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
@fredrick
fredrick / wordpress.sql
Created May 23, 2012
WordPress Test Installation
View wordpress.sql
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `wordpress`
--
-- --------------------------------------------------------
--
-- Table structure for table `wp_commentmeta`
You can’t perform that action at this time.