Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# Author: Alexandre Défossez, 2020
# This is free and unencumbered software released into the public domain.
# For more information, please refer to <http://unlicense.org/>
"""
Merge multiple bibfiles, remove duplicates and unused references, matching bibtex entries
based on the 'title' field. Rewrite all the .tex files in the current directory
to reflect the elimination of duplicates.
Finally, this will rewrite all the arXiv references to use the @unpublished category.
@unixpickle
unixpickle / README.md
Created November 14, 2019 20:58
Hacking Lily's Garden

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
import re
import os
import glob
import pandas as pd
import matplotlib.pyplot as plt
from collections import OrderedDict
fig_size = [12, 9]
anonymous
anonymous / pca_animation.m
Created January 26, 2017 21:47
Matlab code to produce PCA animations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Matlab code to produce PCA animations shown here:
% http://stats.stackexchange.com/questions/2691
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Static image
clear all
rng(42)
@ramhiser
ramhiser / one-hot.py
Last active April 7, 2021 06:44
Apply one-hot encoding to a pandas DataFrame
import pandas as pd
import numpy as np
from sklearn.feature_extraction import DictVectorizer
def encode_onehot(df, cols):
"""
One-hot encoding is applied to columns specified in a pandas DataFrame.
Modified from: https://gist.github.com/kljensen/5452382
@jboner
jboner / latency.txt
Last active May 2, 2024 09:45
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD