Skip to content

Instantly share code, notes, and snippets.

View keon's full-sized avatar

Keon keon

View GitHub Profile
@keon
keon / loadFiles.js
Last active August 29, 2015 14:22
load all files in selected directory in javascript
// load all files in models dir
fs.readdirSync(__dirname + '/app/models').forEach(function(filename){
if (~filename.indexOf('.js')) require(__dirname + '/app/models/' + filename)
});
@keon
keon / elasticsearch.sh
Last active August 29, 2015 14:27
elasticsearch install
### USAGE
###
### ./ElasticSearch.sh 1.5.0 will install Elasticsearch 1.5.0
### ./ElasticSearch.sh 1.4.4 will install Elasticsearch 1.4.4
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
### ElasticSearch version
@keon
keon / The Technical Interview Cheat Sheet.md
Created February 28, 2016 12:25 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
keon@ubuntu:~/Downloads/kernels$ wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-{image,image-extra,headers}-4.4.0-17-generic_4.4.0-17.33_amd64.deb--2016-04-02 23:50:35-- http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-image-4.4.0-17-generic_4.4.0-17.33_amd64.deb
Resolving archive.ubuntu.com (archive.ubuntu.com)... 91.189.88.153, 91.189.91.15, 91.189.91.13, ...
Connecting to archive.ubuntu.com (archive.ubuntu.com)|91.189.88.153|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18566294 (18M) [application/x-debian-package]
Saving to: ‘linux-image-4.4.0-17-generic_4.4.0-17.33_amd64.deb’
100%[============================================================>] 18,566,294 1.56MB/s in 13s
2016-04-02 23:50:48 (1.38 MB/s) - ‘linux-image-4.4.0-17-generic_4.4.0-17.33_amd64.deb’ saved [18566294/18566294]
// Load Data and Labels in double types
data::Load(inputFile, data, true);
data::Load(inputLabel, labels, true);
arma::rowvec labels_row = labels.row(0); // extract first row
// Split Data
const auto value = data::TrainTestSplit(data, labels_row, testRatio);
Log::Info << "Train Data Count: " << get<0>(value).n_cols << endl;
Log::Info << "Test Data Count: " << get<1>(value).n_cols << endl;
#include <iostream>
using namespace std;
template <typename ObjectType>
class BaseClass{
public:
friend ObjectType;
int Increment(){
return obj.Increment();
# coding: utf-8
# Imports
import os
import cPickle
import numpy as np
import theano
import theano.tensor as T
#!/bin/bash
# stop on error
set -e
############################################
# install the required packages
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get -y install linux-headers-$(uname -r) linux-image-extra-`uname -r`
# install cuda
@keon
keon / README.md
Created February 4, 2017 11:24 — forked from tambetm/README.md

Used dueling network architecture with Q-learning, as outlined in this paper:

Dueling Network Architectures for Deep Reinforcement Learning
Ziyu Wang, Tom Schaul, Matteo Hessel, Hado van Hasselt, Marc Lanctot, Nando de Freitas
http://arxiv.org/abs/1511.06581

Command line:

python duel.py CartPole-v0 --gamma 0.995
class Fenwick{
private:
const int maxN = 10000;
public:
int table[maxN];
int sumQuery(int a, int b){
return sumQuery(b) - sumQuery(a-1);
}