Skip to content

Instantly share code, notes, and snippets.

//Resize to Width Height
ffmpeg -i input.mp4 -s WxH -qscale 0 -vcodec mpeg4 output.mp4
//Compress the output file
ffmpeg -i output.mp4 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -vcodec h264 -acodec mp2 output-final.mp4
@endolith
endolith / gcd_and_lcm.py
Last active June 22, 2022 23:33
GCD and LCM functions in Python for several numbers
# Greatest common divisor of 1 or more numbers.
from functools import reduce
def gcd(*numbers):
"""
Return the greatest common divisor of 1 or more integers
Examples
--------
@DakuTree
DakuTree / decryptchromecookies.pl
Last active May 24, 2023 04:47
Decrypt Chrome Cookies File (Perl) - Windows
#!/usr/bin/perl -w
use File::Copy qw(copy);
use DBI;
use Win32::API;
use strict;
use warnings;
print ("Decrypting cookies...\n") && &fix_cookies && print ("Cookies decrypted!\n");
@alper111
alper111 / vgg_perceptual_loss.py
Last active April 10, 2024 02:21
PyTorch implementation of VGG perceptual loss
import torch
import torchvision
class VGGPerceptualLoss(torch.nn.Module):
def __init__(self, resize=True):
super(VGGPerceptualLoss, self).__init__()
blocks = []
blocks.append(torchvision.models.vgg16(pretrained=True).features[:4].eval())
blocks.append(torchvision.models.vgg16(pretrained=True).features[4:9].eval())
blocks.append(torchvision.models.vgg16(pretrained=True).features[9:16].eval())