Skip to content

Instantly share code, notes, and snippets.

// Muscle Memory (Command-based)
Command + A (Select , Esc to exit)
Command + B (Run Build)
Command + C (Copy)
Command + D (Selects the word the cursor is on, Press it again to create another cursor on the next selection)
Command + F (Open Find Console)
Command + G (to jump/move cursor forward from one Search result to next)
Command + H (Hide Sublime Text)
Command + I (Incremental find)
Command + J (Join Line)
#should have known R already has horizon plot functionality
#latticeExtra (already a favorite package of mine) has it sitting right there
#http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=latticeExtra:horizonplot
require(lattice)
require(latticeExtra)
require(reshape2)
require(quantmod)
# setup the environment
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, np.pi*4, 137)
y = (2*np.random.normal(size=137) + x**2)
# reflect everything around the origin
xx = np.hstack([-1*x[::-1], x])
yy = np.hstack([-1*y[::-1], y])
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
/*
Yahoo Finance stock historical data, prices and details retrieval function written in Javascript, jQuery and YQL
v2013-08-05
(c) 2013 by Fincluster ltd - http://fincluster.com <[email protected]>
*/
(function($) {
function getStock(opts, type, complete) {
var defs = {
desc: false,
baseURL: 'http://query.yahooapis.com/v1/public/yql?q=',
############################################################
## Using Genetic Algorithms in Quantitative Trading
##
## [email protected] - Mar 2014
############################################################
library(PerformanceAnalytics)
library(rgenoud)
library(quantmod)
library(TTR)
function gnn (cases, wide, tall, population, iterations, error_fn, error_thresh) {
var inputs = cases[0][0].length;
var outputs = cases[0][1].length;
// declare net, provide input layer
var net = [new Array(inputs)];
// create input neurons in input layer
for (var i = 0; i < inputs; i++)
net[0][i] = {output: 0}
// create hidden layers
for (var x = 0; x < wide; x++) {
@markcheno
markcheno / gys.r
Created May 29, 2014 13:08 — forked from ivannp/gys.r
#' Saves symbols (from an environment) to a specified directory
#'
#' The files (one per symbol) are saved in \code{dir}. The file name
#' is the symbol itself, and the file extension is RData.
#'
#' @param symbols The symbols
#' @param dir The destination folder (file system directory). It must exist.
#' @param env The environment containing the symbols
#'
#' @examples
import operator
import math
import random
import struct
import numpy
from deap import algorithms
from deap import base
from deap import creator
# Mostly stolen from deap's symbreg GP example
import operator
import math
import random
import string
import inspect
import ctypes
import numpy
from scipy import optimize