Skip to content

Instantly share code, notes, and snippets.

View jonowo's full-sized avatar
🔢

Jonathan Leung jonowo

🔢
  • Toronto, Canada
  • 11:42 (UTC -05:00)
View GitHub Profile
@jonowo
jonowo / InstallSignalEN.py
Last active June 15, 2024 16:07 — forked from SpawnY0815/InstallSignalEN.py
Simple Python script for automating the installation of signal-cli, the DBus service, and registering a new user. Fork of https://gist.github.com/Vic3198/f0c9e17ef3d70e7b8c066bfd8cf4db2d
# Run this Python 3 script with superuser rights ('sudo') to install the Signal client
input("Welcome to the signal-cli install wizard.\nPress ENTER when you are ready.")
import os
yes = ['Oui', 'Yes', 'O', 'Y', 'oui', 'yes', 'o', 'y']
javaInstalled = input(
@jonowo
jonowo / resize_gif_to_512x512.py
Last active January 1, 2022 06:46
Resize an animated GIF to 512 x 512 by scaling and padding.
"""
Resize an animated GIF to 512 x 512 by scaling the photo to fit
then padding the remaining space with the color of the topleft pixel.
Note: May not work well with GIFs with transparency.
To turn GIFs into animated stickers for Signal, resize them with this script before
converting them to APNG with the gif2apng CLI (http://gif2apng.sourceforge.net/).
"""
@jonowo
jonowo / random_tree.py
Created October 22, 2021 11:54
Generate a random tree with n nodes using a Prüfer sequence.
"""
Generate a random tree with n nodes using a Prüfer sequence.
Can be used for creating test cases in competitive programming.
Time complexity: O(n^2)
Algorithm: https://en.wikipedia.org/wiki/Pr%C3%BCfer_sequence
"""
import random