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 / hi.js
Created Feb 12, 2020
Bilinear interp
View hi.js
const canvas = document.createElement('canvas');
canvas.width = 400;
canvas.height = 400;
const ctx = canvas.getContext('2d');
ctx.font = '350px serif';
ctx.textBaseline = 'middle';
ctx.textAlign = 'center';
ctx.fillText('Hi', 200, 200);
const data = ctx.getImageData(0, 0, 400, 400);
View involutes.py
import math
def involute_point(a, t):
c = math.cos(t)
s = math.sin(t)
d = t - a
return c + d * s, s - d * c
@unixpickle
unixpickle / extract_tar.go
Created Dec 22, 2019
Extract ImageNet tar in-place
View extract_tar.go
// Command extract_tar can be used to extract a large
// ImageNet tarbal on a system that doesn't have enough
// storage for both the tarbal and the untarred data.
//
// As it extracts the tarbal, it truncates the original
// tar file so that it takes up less and less space.
//
// Based on this earlier gist for processing ImageNet tars:
// https://gist.github.com/unixpickle/7304c78032c9f433e28a87409f4d5aca
package main
@unixpickle
unixpickle / data.py
Created Nov 18, 2019
3D model generator model
View data.py
"""
Reading data produced by an external program.
"""
import math
import random
import numpy as np
import torch
@unixpickle
unixpickle / README.md
Created Nov 14, 2019
Hacking Lily's Garden
View README.md

Overview

In this document, I will describe how I managed to get unlimited stars and coins in the Android game "Lily's Garden". In short, here are the steps:

  • Use the adb backup feature to extract all of the game's data
  • Extract the Android backup into a tar file
  • Modify the file which stores the number of coins and stars
  • Re-sign the coins/stars field using a reverse-engineered HMAC key
  • Convert the tar file back to an Android backup
@unixpickle
unixpickle / load_collider.go
Created Nov 2, 2019
3D model generator data source
View load_collider.go
package main
import (
"compress/gzip"
"fmt"
"math"
"os"
"github.com/unixpickle/model3d"
)
View maml.py
import math
import torch
import torch.nn.functional as F
def maml_grad(model, inputs, outputs, lr, batch=1, checkpoint=False):
"""
Update the model gradient using MAML.
"""
@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
You can’t perform that action at this time.