Skip to content

Instantly share code, notes, and snippets.

@shurain
shurain / autoencoder.py
Created October 6, 2012 16:31 — forked from anonymous/autoencoder.py
Python: Sparse Autoencoder
import numpy as np
#from matplotlib import pyplot as plt
from scipy.optimize import fmin_l_bfgs_b as bfgs,check_grad,fmin_bfgs,fmin_tnc
from scipy.io import loadmat
import cPickle
class params:
'''
@shurain
shurain / fix-venv.sh
Created February 17, 2017 08:24 — forked from pv8/fix-venv.sh
Fix virtualenv symlinks after upgrading python with Homebrew and running brew cleanup
#!/usr/bin/env bash
#
# Fix virtualenv symlinks after upgrading python with Homebrew and then running
# `cleanup`.
#
# After upgrading Python using Homebrew and then running `brew cleanup` one can
# get this message while trying to run python:
# dyld: Library not loaded: @executable_path/../.Python
# Referenced from: /Users/pablo/.venv/my-app/bin/python
# Reason: image not found
@shurain
shurain / nvaltjournal
Created August 8, 2012 18:50
nvALT: Fix for "Append to nvALT journal" Alfred extension. Handling non-English characters as well.
on alfred_script(q)
set theYear to year of (current date) as string
set theMonth to (month of (current date) as number)
if theMonth < 10 then
set theMonth to "0" & theMonth
else
set theMonth to "" & theMonth
end if
@shurain
shurain / min-char-rnn.py
Created June 4, 2016 16:08 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
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)
@shurain
shurain / README.md
Created March 19, 2016 14:40 — forked from EderSantana/CATCH_Keras_RL.md
Keras plays catch - a single file Reinforcement Learning example

Code for Keras plays catch blog post

Train

python qlearn.py

Generate figures

python test.py
@shurain
shurain / nginx.conf
Created January 11, 2016 03:48 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@shurain
shurain / arxiv2kindle.ipynb
Created January 16, 2016 15:19 — forked from bshillingford/arxiv2kindle.ipynb
arxiv2kindle: recompiles an arxiv paper for kindle-sized screens, and sends it to your wifi-enabled kindle
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shurain
shurain / matrix_sketch.py
Created November 6, 2013 05:09 — forked from mblondel/matrix_sketch.py
Frequent directions algorithm for matrix sketching.
# (C) Mathieu Blondel, November 2013
# License: BSD 3 clause
import numpy as np
from scipy.linalg import svd
def frequent_directions(A, ell, verbose=False):
"""
Return the sketch of matrix A.
#readOverlay {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
}
#readInner {
text-align: left;
line-height: 1.4em;
@shurain
shurain / naverreadability.js
Created August 3, 2013 14:39
Readability for Naver blog. Ripped off from brettterpstra.com/share/readability.js
var readabilityVersion = "2";
var readStyle='style-ebook';
var readSize='size-medium';
var readMargin='margin-wide';
(function(){
// removing all existing scripts so they don't cause conflicts...
var docscripts = document.getElementsByTagName('script');
for (k=0;k < docscripts.length; k++) {
if (docscripts[k].src != null && ! docscripts[k].src.match(/readability|[Cc]lippability/)) {
docscripts[k].parentNode.removeChild(docscripts[k]);