Skip to content

Instantly share code, notes, and snippets.

View Palisand's full-sized avatar
🥩
Ya got angus?

Panaos Alisandratos Palisand

🥩
Ya got angus?
  • Ngo Consulting
  • NYC
View GitHub Profile
// https://stackoverflow.com/a/54761452/3446870
const {promisify} = require('util');
const readline = require('readline');
async function readlineQuestion(question) {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
from collections import defaultdict
from typing import Callable, Dict, Iterable, List, Optional
T = TypeVar("T")
U = TypeVar("U")
def group_by(
func: Callable[[T], U],
coll: Iterable[T],
@Palisand
Palisand / gif_to_mp4.py
Last active January 9, 2022 00:45
An old gif_to_mp4 python script written fresh outta college
"""
gif_to_mp4
Converts GIFs from an input directory to MP4s or a single GIF file to an MP4
and stores them in the same directory if an output location is not specified.
Also, generates a preview image if desired.
Usage:
gif_to_mp4.py <input_file_or_directory> [-o=<output_directory>]
gif_to_mp4.py prev <input_file_or_directory> [-o=<output_directory>] [-p=<output_directory>]
@Palisand
Palisand / convert_to_jpg.py
Created January 9, 2022 00:43
An old convert_to_jpg python script written fresh outta college
"""
convert_to_jpg
Converts image formats that browsers don't commonly support (TIFF, BMP, SGI, RGB, etc.)
to JPGs and stores them in the same directory if an output location is not specified.
Please ignore the following warning:
[swscaler @ 0x7fdabb825e00] deprecated pixel format used, make sure you did set range correctly
Usage:
@Palisand
Palisand / image_transcoding.py
Created January 9, 2022 00:46
Old python code for transcoding images
"""
Helpers to transcode images.
DEPENDENCIES
------------
imagemagick (for converting, already installed)
avconv (for transcoding) sudo apt-get install libav-tools
libx264 (higher encoding quality) sudo apt-get install libavcodec-extra-53
http://askubuntu.com/questions/266663/ffmpeg-resize-could-not-find-codec-parameters