Skip to content

Instantly share code, notes, and snippets.

View ToshY's full-sized avatar
🗯️
I don't know everything. I just know what I know.

ToshY

🗯️
I don't know everything. I just know what I know.
View GitHub Profile
@ToshY
ToshY / ffmpeg-single-frame
Created February 2, 2021 22:02
FFmpeg single frame / screenshot
ffmpeg -ss 00:00:10 -i "input.mp4" -vframes 1 -q:v 2 -s 960:540 "output.jpg"
@ToshY
ToshY / ffmpeg-mp4-to-webp
Last active March 2, 2021 00:24
FFmpeg MP4 to WebP 10 second 24FPS fragment
ffmpeg -i "input.mp4" -vcodec libwebp -filter:v fps=fps=23.976 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 320:180 -ss 00:00:15 -t 00:00:10 "output.webp"
@ToshY
ToshY / AvailableFontsOnSystem.py
Created November 22, 2020 19:27
Get all available fonts on the system using MatPlotLib and FontTools with Python 3.8
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 22 16:16:46 2020
@author: ToshY
One of the more "reliable" ways to check for fonts on the current system with the help of MatPlotLib (and FontTools).
Returns list of dictonaries, where each dictonary denotes a single font, with a Path object, the name, the font family
and the style.
@ToshY
ToshY / SimpleMailJetSender.php
Created September 5, 2020 17:50
Simple MailJet API v3 email sender in PHP
<?php
class MailJetAPI{
/*
* Simpel MailJet mailer with the v3 API
*/
private const BASE_URL = 'https://api.mailjet.com/v3.1/send';
private $key;
private $secret;
@ToshY
ToshY / SimpleHasher.php
Created September 5, 2020 17:33
Simple hasher in PHP
<?php
class SimpleHasher{
/*
/* Simple hash
*/
private $hash_algo;
function __construct( $algo = 'sha256' ){
@ToshY
ToshY / OneWayEncryption.php
Last active September 5, 2020 17:52
Simple one-way encryption in PHP
<?php
class OneWayEncryption{
/*
* One way encryption; hash + salt
*/
private const COST = '14';
private function uniqueSalt() {
@ToshY
ToshY / random_string.ps1
Created August 5, 2020 19:08
Random string with PS
[CmdletBinding()]
<#
.SYNOPSIS
Create a random string of alphanumeric characters
.DESCRIPTION
This function creates a random string of alphanumeric characters.
Alphanumeric characters are put into an array, joined, randomly picked and shuffled once more.
.PARAMETER length
The length of the random string to be returned.
@ToshY
ToshY / m3u8tomp4.md
Last active May 24, 2020 23:42
FFmpeg m3u8 to mp4
ffmpeg -i in.m3u8 -acodec copy -bsf:a aac_adtstoasc -vcodec copy out.mp4
@ToshY
ToshY / BunnyVOD.php
Last active July 17, 2023 04:44
BunnyCDN VOD HLS Token Authentication V2 with directory tokens
<?php
/*
VOD HLS streaming for BunnyCDN with Token authentication V2
NOTES:
> Credits to Dejan from BunnyCDN Support for the function for token authentication V2
> I've created this snippet to show how to use HLS streaming with the directory tokens.
This is a workaround which works by appending the token query string for every request to the TS segments (see JS below)
@ToshY
ToshY / string_incrementer.py
Last active September 5, 2020 17:54
Python simple string incrementer
# -*- coding: utf-8 -*-
"""
Created on Fri May 8 00:07:46 2020
@author: ToishY
My favorite online string increment tool "was" dead (http://www.mynikko.com/tools/tool_incrementstr.html), so I made this snippet back then.
Haven't tested it fully but seems to work.
Note: