Skip to content

Instantly share code, notes, and snippets.


Alex Nichol unixpickle

View GitHub Profile
View decimate.go
func DecimateMesh(m *model2d.Mesh, maxVertices int) *model2d.Mesh {
m = model2d.NewMeshSegments(m.SegmentsSlice())
areas := map[model2d.Coord]float64{}
for _, v := range m.VertexSlice() {
areas[v] = VertexArea(m, v)
for len(areas) > maxVertices {
var next model2d.Coord
nextArea := math.Inf(1)
View binarized_mnist.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View box.go
func CreateMesh() *model3d.Mesh {
box := model3d.NewMesh()
stepSize := 0.05
addQuad := func(p model3d.Coord3D, normalAxis int) {
ax1 := model3d.Coord3D{X: stepSize}
ax2 := model3d.Coord3D{Y: stepSize}
if normalAxis == 0 {
ax1 = model3d.Coord3D{Z: stepSize}
} else if normalAxis == 1 {
unixpickle / go.mod
Last active May 8, 2020
Deformation into sphere
View go.mod
module gists/deformation
go 1.14
require ( v1.1.0 v0.2.1 v0.0.0-20200508163631-1844661b331d
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);
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 / 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:
package main
unixpickle /
Created Nov 18, 2019
3D model generator model
Reading data produced by an external program.
import math
import random
import numpy as np
import torch
unixpickle /
Created Nov 14, 2019
Hacking Lily's Garden


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 / load_collider.go
Created Nov 2, 2019
3D model generator data source
View load_collider.go
package main
import (
You can’t perform that action at this time.