Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Keon keon

💭
I may be slow to respond.
View GitHub Profile
@keon
keon / loadFiles.js
Last active Aug 29, 2015
load all files in selected directory in javascript
View loadFiles.js
// 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 Aug 29, 2015
elasticsearch install
View elasticsearch.sh
### 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 Feb 28, 2016 — 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.
View The Technical Interview Cheat Sheet.md

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.
View gist:38cc1ad13a7bd165a1788d9fe5b4ac36
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]
View example.cpp
// 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;
View class + object + friend
#include <iostream>
using namespace std;
template <typename ObjectType>
class BaseClass{
public:
friend ObjectType;
int Increment(){
return obj.Increment();
View spynet.py
# coding: utf-8
# Imports
import os
import cPickle
import numpy as np
import theano
import theano.tensor as T
@keon
keon / map.js
Last active Oct 21, 2016
use of map to reorganize JSON object array in javascript
View map.js
var data = [
{
"answer_content": "2322323",
"user_id": 49,
"user_name": "soemthing"
},
{
"answer_content": "22222",
"user_id": 50,
"user_name": "soemthing"
View setup tensorflow on aws
#!/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
View 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