Skip to content

Instantly share code, notes, and snippets.

\documentclass[11pt,oneside]{article}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage[usenames,dvipsnames]{color}
\usepackage[USenglish]{babel}
\usepackage[num,USenglish]{isodate}
\usepackage{colortbl}
\usepackage{array}
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
remove.empty <- function(the.data) {
nums <- sapply(the.data, is.numeric)
numeric.data <- the.data[,nums]
cat.data <- the.data[,-nums]
not.empty <- colSums(numeric.data) > 0
cbind(cat.data, numeric.data[,not.empty])
}
iter discount reward model time.secs
1 0.1 337.64 Value.Iteration 0.0035438538
2 0.1 356.68 Value.Iteration 0.0011398792
3 0.1 356.08 Value.Iteration 0.0015702248
4 0.1 357.64 Value.Iteration 0.0022630692
5 0.1 356.36 Value.Iteration 0.0020890236
6 0.1 355.56 Value.Iteration 0.0025310516
7 0.1 354.80 Value.Iteration 0.0028641224
8 0.1 355.68 Value.Iteration 0.0051300526
9 0.1 357.88 Value.Iteration 0.0035381317
@jameskyle
jameskyle / main.R
Last active April 25, 2016 23:13
library(MDPtoolbox)
library(Matrix)
library(ggplot2)
library(grid)
library(gridExtra)
library(doMC)
cores <- detectCores() - (detectCores() / 2) / 2
registerDoMC(cores=cores)
set.seed(1234)
SELECT
s.SERVER_NAME as SERVER_NAME,
s.FOO,
s.BAR,
s.TIMESTAMP as SERVER_TIME,
n.SERVER_NAME as N_SERVER_NAME,
n.TIMESTAMP as N_TIME,
n.BAH,
n.BAZ,
EXTRACT(EPOCH from s.TIMESTAMP - n.TIMESTAMP) as DIFF
parse.or.na <- function(d, func) {
wrapper <- function(x) {
tryCatch(func(x),
error=function(e) {
print(e)
NA
}
)}
lapply(data, wrapper)
}
S <- array(c(
# Wait
# Fire, Young Forest, Old Forest, Farm
0.1, 0.9, 0.0, 0.0,
0.1, 0.0, 0.9, 0.0,
0.1, 0.0, 0.9, 0.0,
0.1, 0.0, 0.0, 0.9,
# Cut
# Fire, Young Forest, Old Forest, Farm
1, 0, 0, 0,
@jameskyle
jameskyle / foo.txt
Last active November 15, 2015 02:48
2 parts oxyclean free to 1 part tsp, by weight
tsp = trisodium phosphate
(get it in the paint department of a home improvement storew)
#include<iostream>
using namespace std;
const int DATAGRAM_LENGTH = 64;
const int BIT_LENGTH = 8;
void text_to_bin(string block, bool output[DATAGRAM_LENGTH]) {
int current = 0;
for (int i = 0;i < block.length();i++) {