Skip to content

Instantly share code, notes, and snippets.

View martinpeck's full-sized avatar

Martin Peck martinpeck

View GitHub Profile
martinpeck /
Last active July 29, 2020 15:57
Some Useful Scripts for iMessage Sticker Creation

These two scripts can help when building assets for iMessage sticker packs.


  • Both scripts worked at the time I authored them, for my very specific needs (taking 1024x1024 PNG original art files, and resizing them on my MacBook).
  • Both scripts use convert which is installed as part of ImageMagik.
  • The AppStore requirements change frequently (as new devices are launched) and I've not updated these scripts in a very long time

Generates the icons required for the App Store

import click
import json
@click.argument('file', type=click.File('rb'))
def dostuff(file):
config = json.load(file)
martinpeck / latency.txt
Created February 9, 2017 13:39 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
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
martinpeck /
Created January 15, 2017 21:35
Shell Script to Create iMessage Sticker Pack Icons for XCode
# takes src.png (assume 1024x1024) and creates the icons required for an iMessage sticker pack
# run on mac: sh src.png
convert $1 -resize 1024x768^ -background white -gravity center -extent 1024x768 messages-app-store-1024x768.png # aspect ratio 1.333
convert $1 -resize 96x72^ -background white -gravity center -extent 96x72 messages-32x24@3x.png # aspect ratio 1.333
convert $1 -resize 64x48^ -background white -gravity center -extent 64x48 messages-32x24@2x.png # aspect ratio 1.333
convert $1 -resize 81x60^ -background white -gravity center -extent 81x60 messages-27x20@3x.png # aspect ratio 1.353