Skip to content

Instantly share code, notes, and snippets.

View benkant's full-sized avatar

Ben Giles benkant

View GitHub Profile
@benkant
benkant / like_totally.py
Created November 16, 2010 12:41
Solution to Problem 10 of Project Euler... in Like, Python
ohai so uh like totally import math bro
anyways like result = 0 yeah
right test_number actually = 0
friggin for test_number totally in ma range(0, 2000000):
if teh test_number <= 1 shiiit:
lol is_prime = False bro
so elif test_number is actually 2 wicked:
bro is_prime = hella True
@benkant
benkant / vimrc_hjkl
Created December 16, 2010 15:23
Disable arrow keys in Vim
" Using arrow keys is far too ingrained in my muscle memory.
" This goes into my ~/.vimrc to force my hand
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
@benkant
benkant / git_changelog
Created December 30, 2010 12:40
Git changelog
git log --no-merges --pretty=format:'* %s - %an' tag-1..tag-2
$.ajaxPrefilter( function( options ) {
if ( options.crossDomain ) {
var newData = {};
newData.data = $.extend({}, options.data);
newData.url = options.url;
options = {};
options.url = "http://www.baskettrack.co/proxy.php";
options.data = $.param(newData);
options.crossDomain = false;
}
@benkant
benkant / site_terms.py
Last active August 29, 2015 14:16
check a bunch of sites for a bunch of terms
#!/usr/bin/env python
import re, urllib, sys
from urlparse import urlparse, urlunparse
terms = ['deepmind', 'recursive']
sites = ['http://torch.ch', 'http://www.arcadelearningenvironment.org/']
for site in sites:
base_url = urlparse(site)
Jinja2==2.7.3
MarkupSafe==0.23
PySide==1.2.2
Pygments==2.0.2
astroid==1.3.4
backports.ssl-match-hostname==3.4.0.2
certifi==14.05.14
colorama==0.3.1
doxypypy==0.8.7
httmock==1.2.2
#!/bin/sh
# https://github.com/lindes/get-location
# home is where you throw your rug
prog=~/code/get-location/get-location
echo "" >> "$1"
if [ -x "$prog" ]
then
$prog >> "$1"
else
echo "Location: " >> "$1"
@benkant
benkant / ssh_rc
Last active September 20, 2016 09:04
#!/bin/bash
# Fix SSH auth socket location so agent forwarding works with screen.
if test "$SSH_AUTH_SOCK" ; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
# Taken from the sshd(8) manpage.
if read proto cookie && [ -n "$DISPLAY" ]; then
if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
@benkant
benkant / pg-pong.py
Created September 4, 2017 05:52 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@benkant
benkant / tensorflow-cpu.sh
Last active December 11, 2017 15:54 — forked from Zhomart/tensorflow-cpu.sh
Compile and install tensorflow on Ubuntu 16.04. You might want to create a virtual machine on GCP, AWS, then compile tensorflow there. And then download compiled `*.wheel` file for further using it. List of compiled tensorflow with different options can be found here https://github.com/yaroslavvb/tensorflow-community-wheels/issues.
#!/bin/bash
##
## FROM https://github.com/floydhub/dl-docker
##
## Before running the script change versions and compilation flags below.
## If you're having trouble running the whole script, try running
## each command separately.
##
## List of compiled tensorflow packages https://github.com/yaroslavvb/tensorflow-community-wheels/issues