Skip to content

Instantly share code, notes, and snippets.

Avatar

hai haiy

View GitHub Profile
@haiy
haiy / min-char-rnn.py
Created Nov 12, 2017 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
View min-char-rnn.py
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@haiy
haiy / jupyter
Created Oct 14, 2016 — forked from jmtatsch/jupyter
A service (init.d) script for jupyter
View jupyter
#! /bin/sh
### BEGIN INIT INFO
# Provides: jupyter
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start jupyter
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@haiy
haiy / tmux.md
Created Jul 23, 2016 — forked from andreyvit/tmux.md
tmux cheatsheet
View tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
View vim_cheatsheet.md

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
View gist:f2ca4a4d16efc8e3453cacae0bf1be26
time mysqlimport --use-threads 10 --fields-terminated-by , -uroot -proot --local kaggle events.csv
View gist:e1ef2c74276a0be8b4dd498873d0ec98
dz-h@dzh-H:~/Desktop/kaggle_test/csv_data$ time mysqlimport --use-threads 10 --fields-terminated-by , -uroot -proot --local kaggle app_events.csv
mysqlimport: [Warning] Using a password on the command line interface can be insecure.
kaggle.app_events: Records: 32473068 Deleted: 0 Skipped: 0 Warnings: 3
real 2m28.837s
user 0m0.084s
sys 0m0.568s
View clone_hbase_table.sh
#!/bin/bash
#author: haiy
#date: Mon Mar 30 17:01:00 CST 2015
src=$1
dst=$2
tmp=$dst"_tmp"
red=$'\e[31m'
reset=$'\e[0m'
if [[ $# -lt 2 ]]; then
echo "Usage: clone_table source_table_name target_table_name"
@haiy
haiy / json.scala
Last active Aug 29, 2015
json scala simple
View json.scala
import java.util
import org.scalatest.FunSuite
import scala.util.parsing.json._
import org.json.JSONObject
import scala.collection.JavaConverters._
/**
* Created by haiy on 5/21/15.
*/
View scala map merge
def merge(m1: Map[String, Int], m2: Map[String, Int]): Map[String, Int] =
m1 ++ m2.map { case (k, v) => k -> (v + m1.getOrElse(k, 0)) }
View java code style check
1. java style check
http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-checker-config.html
http://stackoverflow.com/questions/12180765/maven-check-style-as-a-part-of-the-build