Skip to content

Instantly share code, notes, and snippets.

View timrach's full-sized avatar

Tim Rach timrach

View GitHub Profile
@timrach
timrach / ab2tar.py
Created December 25, 2023 19:22
Convert Android Backup file to tarball
import zlib
# Read the android backup file 'backup.ab' and
# convert it to a tar archive file 'backup.tar'
with open("backup.ab", "rb") as input:
_skip = input.read(24)
_bytes = input.read()
data = zlib.decompress(_bytes)
open("backup.tar", "wb").write(data)
@timrach
timrach / unpack.sh
Created May 22, 2022 20:31
Unpack .unitypackage with commandline tools on OSX
# Unpacks a file.unitypackage to a given folder:
# example: 'sh ./unpack.sh demo.unitypackage outputfolder'
# commands adjusted to work on OSX
mkdir $2
tar zxfv $1 --directory $2
find $2 -name asset -exec bash -c '\
filename="`dirname "$(dirname "{}")"`/`cat "$(dirname "{}")/pathname" \
| cut -d$'"'\n'"' -f1 \
FROM rust:1.60 as build
# create a new empty shell project
RUN USER=root cargo new --bin holodeck
WORKDIR /holodeck
# copy over your manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
@timrach
timrach / imagicheet.txt
Created December 21, 2020 13:10
ImageMagick Cheat Sheet
#!/bin/bash
# Take a window of 600x600 pixels of each image and slice it into tiles of 200x200 pixels.
# Save the tiles into a folder ./tiles
mkdir ./tiles
for f in *.jpg; do
filename=$(basename -- "$f")
extension="${filename##*.}"
filename="${filename%.*}"
echo "Processing $f file..";
@timrach
timrach / SpriteReplacer.cs
Created December 18, 2020 10:13
Unity editor window to bulk replace sprites of selected SpriteRenderer components
using System.Collections.Generic;
using UnityEditor;
using System;
using UnityEngine;
public class SpriteReplacerSettingsAsset
{
[MenuItem("Assets/Create/SpriteReplacerSettings")]
// From https://reactjs.org/docs/hooks-faq.html#what-can-i-do-if-my-effect-dependencies-change-too-often
function Counter() {
const [count, setCount] = useState(0);
useEffect(() => {
const id = setInterval(() => {
setCount(count + 1); // This effect depends on the `count` state
}, 1000);
@timrach
timrach / rates.csv
Last active November 20, 2018 08:38
name 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015
Algeria 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 58
American Samoa 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.1 1.1 1.1 1.5
Antigua and Barbuda 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 5 0 0 0 0
Azerbaijan 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 5
Argentina 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0.09 2 8 15 16 15
Australia 0 0 0 11 13 16 19 23 28 34 38 44 50 59 69 79 91 109 127 160 426 1530 2559 3826 4858 5968
Austria 0 0 0 1 1 1 1 2 2 2 3 5 9 15 18 21 22 24 30 49 89 174 337 582 785 937
Bangladesh 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 136 145 154
Armenia 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1