Skip to content

Instantly share code, notes, and snippets.

Alex Nichol unixpickle

Block or report user

Report or block unixpickle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@unixpickle
unixpickle / maml.py
Created Oct 12, 2019
MAML in PyTorch
View maml.py
import torch
import torch.nn.functional as F
def maml_grad(model, inputs, outputs, lr, batch=1):
"""
Update a model's gradient using MAML.
The gradient will point in the direction that
improves the total loss across all inner-loop
View word_stats.py
letters = 'abcdefghijklmnopqrstuvwxyz'
with open('/usr/share/dict/words', 'rt') as in_file:
words = [x.strip() for x in in_file.readlines()]
counts = {}
starts = {}
total = 0
for letter in letters:
counts[letter] = len([x for x in words if x.endswith(letter)])
@unixpickle
unixpickle / config.md
Last active Oct 13, 2019
Configuring Linux Machine
View config.md

This is a set of things I suggest you do on a new Ubuntu machine to make it nice and (almost) Mac-like.

Install some packages

sudo apt install -y xclip
sudo apt install -y caffeine
sudo apt install -y gnome-tweaks
@unixpickle
unixpickle / poly_points.py
Last active Feb 6, 2019
Find vertices of a dodecahedron
View poly_points.py
"""
Generate points for a dodecahedron by solving an
optimization problem.
Gradient descent doesn't always converge to the global
minimum, so I run it repeatedly and keep printing the
solutions it comes up with if they're better than the
previous solution.
"""
@unixpickle
unixpickle / normact.py
Created Feb 4, 2019
Normalization as an activation function
View normact.py
"""
Get 99% accuracy on MNIST with a norm-activated network.
Test set: Average loss: 0.0395, Accuracy: 9880/10000 (99%)
Based on: https://github.com/pytorch/examples/blob/master/mnist/main.py
"""
import argparse
import torch
View puzzle.go
// Solve this logic puzzle:
// https://xmonader.github.io/prolog/2018/12/21/solving-murder-prolog.html
package main
import (
"fmt"
"github.com/unixpickle/approb"
)
View wallpaper.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View drone.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View count_bdays.py
"""
Histogram actors by birthday and astrological sign.
"""
import datetime
import re
import requests
@unixpickle
unixpickle / squircle.js
Created Oct 28, 2018
Squircle smiley face VC
View squircle.js
function(canvas, video) {
function setupAudioLevel() {
window.HACK_VOLUME_LEVEL = 0.0;
navigator.mediaDevices.getUserMedia({ audio: true, video: false }).then((stream) => {
const ctx = new AudioContext();
const source = ctx.createMediaStreamSource(stream);
const node = ctx.createScriptProcessor(4096, 1, 1);
node.onaudioprocess = (event) => {
const buffer = event.inputBuffer.getChannelData(0);
let sum = 0;
You can’t perform that action at this time.