Skip to content

Instantly share code, notes, and snippets.

@fredrick
fredrick / screen.md
Created September 14, 2011 15:30
GNU Screen Cheat Sheet

#GNU Screen Cheat Sheet

##Basics

  • ctrl a c -> cre­ate new win­dow
  • ctrl a A -> set win­dow name
  • ctrl a w -> show all win­dow
  • ctrl a 1|2|3|… -> switch to win­dow n
  • ctrl a " -> choose win­dow
  • ctrl a ctrl a -> switch between win­dow
  • ctrl a d -> detach win­dow
@fredrick
fredrick / FirstSteps.1.md
Created November 9, 2011 21:08
JavaScript In a "Gist" | Client-side web development

#First Steps

##Development environment JavaScript is most commonly added to HTML documents as either an embedded or external script.

<!DOCTYPE html>
<html>
<head>
 
@fredrick
fredrick / ema.wilder.iterative.js
Created January 12, 2012 21:58
Node.JS + v8 profiling
Array = require('gauss').Vector;
var prices = [22.2734, 22.194, 22.0847, 22.1741, 22.184, 22.1344,
22.2337, 22.4323, 22.2436, 22.2933, 22.1542, 22.3926,
22.3816, 22.6109, 23.3558, 24.0519, 23.753, 23.8324,
23.9516, 23.6338, 23.8225, 23.8722, 23.6537, 23.187,
23.0976, 23.326, 22.6805, 23.0976, 22.4025, 22.1725];
/* Use Wilder ratio on an exponential moving average period of 10,
1 million iterations
@fredrick
fredrick / async.py
Created March 17, 2011 21:45
Using Python's multiprocessing module, it's easy to create asynchronous subprocesses
#!/usr/bin/env python
# encoding: utf-8
import random
import time
import multiprocessing
if __name__ == '__main__':
"""Demonstration of GIL-friendly asynchronous development with Python's multiprocessing module"""
@fredrick
fredrick / String.format.js
Created May 16, 2011 22:28
printf()/format() for JavaScript String
/*
* Extend JavaScript String object with printf() like functionality
* "{0} is dead, but {1} is alive!".format("This", "that");
*/
String.prototype.format = function() {
var formatted = this;
for(arg in arguments) {
formatted = formatted.replace("{" + arg + "}", arguments[arg]);
}
return formatted;
@fredrick
fredrick / App-example-test.js
Last active April 6, 2018 12:39
React Router Test Context Helper
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');
});
%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 / UserQuery.js
Created February 1, 2012 02:24
Async.js and Node.js
var async = require('async');
// Waterfall through callbacks using Mongoose to query for a user
async.waterfall([
function(callback) {
/** Function 1. Find User.
* Pass `user` to Function 2.
*/
User.findOne({ username: 'fred' }, function(error, user) {
@fredrick
fredrick / couchdb.conf
Created November 28, 2011 01:43 — forked from kowsik/couchdb.conf
Upstart script for CouchDB
# Upstart file at /etc/init/couchdb.conf
# CouchDB
start on runlevel [2345]
stop on runlevel [06]
pre-start script
chown -R couchdb /usr/local/etc/couchdb
chown -R couchdb /usr/local/lib/couchdb
chown -R couchdb /usr/local/var/log/couchdb
@fredrick
fredrick / hp35.txt
Last active December 24, 2015 00:40
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