Skip to content

Instantly share code, notes, and snippets.

View benkant's full-sized avatar

Ben Giles benkant

View GitHub Profile
@benkant
benkant / spacewindows.sh
Last active February 11, 2018 06:10
spacewindows.sh
#!/usr/bin/env bash
# TODO check we are on macOS
# TODO https://google.github.io/styleguide/shell.xml
INSTANCE_NAME=$INSTANCE_NAME
gcloud compute instances start $INSTANCE_NAME
IPADDRESS=`gcloud compute instances describe $INSTANCE_NAME | grep natIP | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])'`
printf "%s is at %s\n" $INSTANCE_NAME $IPADDRESS
# TODO check Microsoft RDP is installed
@benkant
benkant / gscinit.sh
Created December 21, 2017 08:49
Google Cloud Shell init
#!/usr/bin/env bash
shopt -s expand_aliases
export EDITOR=vim
export VISUAL=vim
mkdir -p $HOME/log # TODO: GCP logging shit
STARTTIME=`date --iso-8601=minutes --utc`
@benkant
benkant / grub
Last active February 11, 2018 23:49
/etc/default/grub for maverick
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT=5
GRUB_TIMEOUT_STYLE=menu
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
@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
@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 / 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
#!/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"
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
@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)
$.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;
}