Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
doing dev

Martin Peck martinpeck

🤓
doing dev
View GitHub Profile
@martinpeck
martinpeck / README.md
Last active Jul 29, 2020
Some Useful Scripts for iMessage Sticker Creation
View README.md

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

WARNING

  • 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. https://apple.stackexchange.com/questions/335635/where-is-the-convert-command-in-macos
  • The AppStore requirements change frequently (as new devices are launched) and I've not updated these scripts in a very long time

build_icons.sh

Generates the icons required for the App Store

View example.py
import click
import json
@click.command()
@click.argument('file', type=click.File('rb'))
def dostuff(file):
config = json.load(file)
print(config[0]["location"])
print(config[0]["saveas"])
@martinpeck
martinpeck / latency.txt
Created Feb 9, 2017 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
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
martinpeck / build_icons.sh
Created Jan 15, 2017
Shell Script to Create iMessage Sticker Pack Icons for XCode
View build_icons.sh
#!/bin/bash
# takes src.png (assume 1024x1024) and creates the icons required for an iMessage sticker pack
# run on mac: sh build_icons.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
You can’t perform that action at this time.