Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
int main(int argc, char* argv[])
{
printf("Hello, world!\n");
return 0;
}
@Tynach
Tynach / telegram-gif.sh
Last active September 14, 2024 16:33
Uses FFMPEG to convert any file FFMPEG understands into a .mp4 file that Telegram will consider as a 'gif', at higher quality than Telegram converts gifs to itself.
#!/bin/bash
# Settings
outfolder="converted"
codec="libx264"
maxres="448"
#filter="crop=floor(in_w/2)*2:floor(in_h/2)*2:0:0:exact=1,colorspace=bt601-6-625:range=pc:irange=tv:iall=bt601-6-625:format=yuv444p12,zscale=rin=full:tin=601:t=linear,scale=if(gt(iw\,ih)\,min($maxres\,floor((iw+1)/2)*2)\,-2):if(gt(iw\,ih)\,-2\,min($maxres\,floor((ih+1)/2)*2)),zscale=rin=full:r=limited:tin=linear:t=601"
filter="scale=if(gt(iw\,ih)\,min($maxres\,floor((iw+1)/2)*2)\,-2):if(gt(iw\,ih)\,-2\,min($maxres\,floor((ih+1)/2)*2)):out_color_matrix=bt601:out_range=tv:flags=accurate_rnd+full_chroma_inp+full_chroma_int+bicublin"
preset="veryslow"
profile="high"
@Tynach
Tynach / apache-time.sed
Created August 29, 2017 19:45
Reformats PHP errors and exceptions, for old versions of PHP which were insane and inconsistent in how they were sent to Apache's logs.
#!/bin/sed -urf
# Modify timestamp format.
s/^\[\w+ \w+ \w+ ([0-9:]{8})\.[0-9]+ \w+\]( \[[^]]+\]){3}( \w+)?/[\1]/
# Hold the first timestamp.
1{
b hold
}