Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I don't know everything, I just know what I know

ToshY

💭
I don't know everything, I just know what I know
  • #0823
View GitHub Profile
@ToshY
ToshY / BinToUuid.php
Last active Apr 16, 2022
Doctrine Extensions UUID_TO_BIN / BIN_TO_UUID with Symfony 5.x / PHP 8.x
View BinToUuid.php
<?php
declare(strict_types=1);
namespace App\Service\Application\Doctrine\DqlFunctions;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\AST\Node;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
@ToshY
ToshY / opcache_max_accelarted_files
Created Feb 1, 2022
opcache max accelerated files php
View opcache_max_accelarted_files
find . -type f -print | grep php | wc -l
@ToshY
ToshY / docker-compose.ngrok.yml
Created Jan 18, 2022
docker compose shkoliar/ngrok example
View docker-compose.ngrok.yml
version: '3.9'
services:
ngrok-app:
image: shkoliar/ngrok
container_name: ngrok-app
ports:
- 4040:4040
environment:
AUTH_TOKEN: "<ngrok-auth-key>"
@ToshY
ToshY / gpg-non-interactive-key.sh
Created Sep 23, 2021
GPG key non-interactive one-liner with variable substitution
View gpg-non-interactive-key.sh
printf "Key-Type: 1\nKey-Length: 2048\nSubkey-Type: 1\nSubkey-Length: 2048\nName-Real: %s\nName-Email: %s\nExpire-Date: 0\nPassphrase: %s" $USER_GPG $EMAIL_GPG $PASSPHRASE_GPG | gpg --batch --gen-key
@ToshY
ToshY / docker-compose.yml
Last active Jul 20, 2021
Wireguard docker-compose config example
View docker-compose.yml
version: '3.7'
services:
wireguard:
image: ghcr.io/linuxserver/wireguard
container_name: wireguard
cap_add:
- NET_ADMIN
- SYS_MODULE
environment:
@ToshY
ToshY / ffmpeg-single-frame
Created Feb 2, 2021
FFmpeg single frame / screenshot
View ffmpeg-single-frame
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 Mar 2, 2021
FFmpeg MP4 to WebP 10 second 24FPS fragment
View ffmpeg-mp4-to-webp
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 Nov 22, 2020
Get all available fonts on the system using MatPlotLib and FontTools with Python 3.8
View AvailableFontsOnSystem.py
# -*- 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 Sep 5, 2020
Simple MailJet API v3 email sender in PHP
View SimpleMailJetSender.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 Sep 5, 2020
Simple hasher in PHP
View SimpleHasher.php
<?php
class SimpleHasher{
/*
/* Simple hash
*/
private $hash_algo;
function __construct( $algo = 'sha256' ){