Skip to content

Instantly share code, notes, and snippets.

View ShadyMedic's full-sized avatar
⚕️
Studying medicine

ShadyMedic

⚕️
Studying medicine
View GitHub Profile
@ShadyMedic
ShadyMedic / SlanderConvert.sh
Created September 2, 2025 10:48
Script to convert different-size videos into templates for slander memes (unifies dimension, adds white stripe to the top)
#!/bin/bash
# ALL SOURCE VIDEOS MUST HAVE AN .mp4 EXTENSION
# If you have different filetypes, edit the hardcoded extension 3 lines below this one
mkdir -p Converted
for file in *.mp4; do
echo Processing $file
ffmpeg -i "$file" -vf "scale='if(gt(iw/ih,1920/808),1920,-1)':'if(gt(iw/ih,1920/808),-1,808)',pad=1920:808:(1920-iw)/2:(808-ih)/2:black,pad=1920:1080:0:272:white" -c:a copy -an "Converted/$file" > /dev/null 2>&1
done
@ShadyMedic
ShadyMedic / .htaccess
Last active July 23, 2023 19:22
Easy Custom Open Directory Index
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-di
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
@ShadyMedic
ShadyMedic / index.php
Created September 24, 2021 12:27
A PHP script for listing all files and directories in the current directory. This is useful if your hosting service provided doesn't let you turn off "Option -Indexes" in the .htaccess file.
<?php
$files = array_diff(scandir('.'), array('.', '..')); //Exclude current and parent folder
//Get the current directory to output proper link addresses
$currentDir = $_SERVER['REQUEST_URI'];
$noProtocolUrl = (strpos($currentDir, '//') !== false) ? substr($currentDir, strpos($currentDir, '//')) : $currentDir;
$urlParts = explode('/', $noProtocolUrl);
if (empty($urlParts[count($urlParts) - 1])) {
//The URL is ending with a trailing slash
$currentDir = rtrim($currentDir, '/');
@ShadyMedic
ShadyMedic / captchaLibrary.php
Created May 10, 2020 17:37
Česká CAPTCHA - přepis čísla ze slova. Funkce vybere náhodné číslo v rozmezí <0;99> a vygeneruje jeho slovní verzi. Slovní verze (sedmdesát tři) je určena pro zobrazení uživateli, který bude muset napsat a odeslat číselnou verzi (73).
/**
* @author Jan Štěch
* @return array[] Asociativní pole s otázkou (slovem) i odpovědí (číslem) - otázka pod indexem "q", odpověď pod indexem "a"
*/
function numberAsWord()
{
$digits = explode(',','nula,jedna,dva,tři,čtyři,pět,šest,sedm,osm,devět');
$tens = explode(',', 'nula,deset,dvacet,třicet,čtyřicet,padesát,šedesát,sedmdesát,osmdesát,devadesát');
$number = rand(0,99);
@ShadyMedic
ShadyMedic / program.cs
Last active March 13, 2020 20:16
A program to convert a palette file written with decimal RGB values to a palette file written with hex RGB values.
/*
A program to convert a palette file written with decimal RGB values to a palette file written with hex RGB values.
Input file format:
RED GREEN BLUE
RED GREEN BLUE
...
Output file format:
RRGGBB
RRGGBB
...
@ShadyMedic
ShadyMedic / randomDateGenerator.php
Last active January 16, 2020 17:09
PHP function letting you generate random date. You can choose minimum and maximum values for year, month, day, hour, minute and second.
function getRandomDate($minYear = 1980, $minMonth = 1, $minDay = 1, $minHour = 0, $minMinute = 0, $minSecond = 0, $maxYear = 2019, $maxMonth = 12, $maxDay = 31, $maxHour = 23, $maxMinute = 59, $maxSecond = 59)
{
$year = rand($minYear, $maxYear);
$month = rand($minMonth, $maxMonth);
$day = rand($minDay, $maxDay);
$hour = rand($minHour, $maxHour);
$minute = rand($minMinute, $maxMinute);
$second = rand($minSecond, $maxSecond);
if ($month < 10){$month = '0'.$month;}
@ShadyMedic
ShadyMedic / template.cs
Created November 22, 2019 17:06
Toto je předlohový zdrojový kód pro programovací soutěže, ve kterých se získává vstup z textového souboru a výstup se odesílá rovněž v souboru. Program se vás na začátku zeptá na soubor a vy tak nemusíte pokaždé měnit zdrojový kód.
using System;
using System.IO;
namespace Kasiopea_1_Pocty
{
class Program
{
static void Main(string[] args)
{
Console.ForegroundColor = ConsoleColor.Gray;