Skip to content

Instantly share code, notes, and snippets.

View alexbw's full-sized avatar

Alex Wiltschko alexbw

  • Google
  • Boston, MA
View GitHub Profile
@karpathy
karpathy / gist:f3ee599538ff78e1bbe9
Last active July 6, 2019 13:34
Batched L2 Normalization Layer for Torch nn package
--[[
This layer expects an [n x d] Tensor and normalizes each
row to have unit L2 norm.
]]--
local L2Normalize, parent = torch.class('nn.L2Normalize', 'nn.Module')
function L2Normalize:__init()
parent.__init(self)
end
function L2Normalize:updateOutput(input)
--[[
LSTM cell. Modified from
https://github.com/oxford-cs-ml-2015/practical6/blob/master/LSTM.lua
--]]
local LSTM = {}
-- Creates one timestep of one LSTM
function LSTM.lstm(opt)
local x = nn.Identity()()
from starcluster.clustersetup import ClusterSetup
from starcluster.logger import log
import subprocess
from starcluster import threadpool
from boto.route53.connection import Route53Connection
from boto.route53.connection import ResourceRecordSets
class Route53Plugin(ClusterSetup):
@mbostock
mbostock / .block
Last active February 9, 2016 01:58
Radial Gradient
license: gpl-3.0
Vagrant.configure("2") do |config|
# Use Ubuntu 12.04 64-bit for now.
config.vm.box = "precise-server-cloudimg-amd64-vagrant-disk1"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
# Provision the VM
config.vm.provision :shell, :path => "vagrant_data/install.sh"
# Configure network
config.vm.network :private_network, ip: "192.168.50.4"
@mattjj
mattjj / chunk_data.py
Last active August 24, 2021 15:11
data chunking with overlapping windows! uses stride tricks so no data is copied; it just produces a view!
from __future__ import division
import numpy as np
from numpy.lib.stride_tricks import as_strided as ast
def chunk_data(data,window_size,overlap_size=0,flatten_inside_window=True):
assert data.ndim == 1 or data.ndim == 2
if data.ndim == 1:
data = data.reshape((-1,1))
# get the number of overlapping windows that fit into the data
@mattjj
mattjj / config.fish
Created March 16, 2013 17:36
in ~/.config/fish/config.fish and ~/.config/fish/functions/fish_prompt.fish
set PATH "$HOME"/bin /opt/local/Library/Frameworks/Python.framework/Versions/Current/bin/\
/opt/local/bin /opt/local/sbin $PATH
set CDPATH . "$HOME" $CDPATH
set fish_greeting ""
function fish_user_key_bindings
bind \e\[1\;9A 'history-token-search-backward'
end
@num3ric
num3ric / gluTestApp.cpp
Created October 29, 2011 05:33
Using glu NURBS inside Cinder.
#include "cinder/app/AppBasic.h"
#include "cinder/gl/gl.h"
#include "cinder/Camera.h"
#include "cinder/MayaCamUI.h"
#if defined( CINDER_MAC )
#include <OpenGL/glu.h>
#else
#include <GL/glu.h>
#endif
@arielm
arielm / Trimesh16.cpp
Created June 2, 2011 12:41
A quick and dirty version of Cinder's Trimesh, to be used on iOS
/*
Copyright (c) 2010, The Barbarian Group
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and