Skip to content

Instantly share code, notes, and snippets.

@nshtg
nshtg / dnsovertls.md
Created May 4, 2021 08:18 — forked from uraimo/dnsovertls.md
Configure your Mac to use DNS over TLS
@nshtg
nshtg / VP9 Encode Guide.md
Created October 10, 2020 12:18
VP9 Encode Guide (ffmpeg, libvpx-vp9, vpxenc)

WIP

VP9 encode is very very slow ?
Yes and no. Unlike x265 use all core to speed up encode time, the low threaded libvpx-vp9 use for me 4 core of my Ryzen 3900X. Encode 4 video in the same time -> x4 "boost".

Quality (Unconstrained)

Force dynamic bitrate with b:v 0
Set quality level with -crf <quality level> is a integer (0 to 63)
libvpx use -deadline and ffmpeg -quality need to be set to good.

@nshtg
nshtg / bruteforce.sh
Created June 4, 2018 21:11
Bruteforce ZIP
#!/usr/bin/env sh
git clone https://github.com/mferland/libzc.git
cd libzc
./autogen.sh
./configure CFLAGS='-Ofast -march=native -mtune=native'
make
sudo make install
@nshtg
nshtg / docker-compose.yml
Created April 10, 2018 16:56
Docker Compose nginx reverse proxy
version: '3'
services:
nginx-proxy:
image: jwilder/nginx-proxy:alpine
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
restart: always
ports:
- "80:80"
- "443:443"
@nshtg
nshtg / packages.sh
Last active June 9, 2023 11:23 — forked from shinchiro/packages.txt
Missing Cygwin/MSYS2 packages
#!/usr/bin/env bash
# Install re2c
cd /tmp &&
git clone --depth 1 https://github.com/skvadrik/re2c.git &&
cd re2c/re2c &&
./autogen.sh &&
./configure --prefix=/usr &&
make -j$(nproc) && make install &&
rm -rf /tmp/re2c
@nshtg
nshtg / mkvmergesubs.sh
Last active October 9, 2017 14:37
mkvmerge subtitles with different fps rate (srt: 23.976fps, mkv: 25fps)
#!/usr/bin/zsh
mkdir -p old
for var in $(ls *.srt | awk -F ".srt" '{print $1}')
do
mkvmerge --priority higher \
-o "$(print $var)1.mkv" \
"$(print $var).mkv" \
--language 0:eng \
--default-track 0:true \
@nshtg
nshtg / mysql-docker.sh
Last active June 7, 2024 07:39 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE > backup.sql
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE | gzip > backup.sql.gz
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE | bzip2 > backup.sql.bz2
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
gunzip < backup.sql.gz | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
bunzip2 < backup.sql.bz2 | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
@nshtg
nshtg / subl
Created September 29, 2017 13:49 — forked from cmalard/subl
Cygwin + Sublime Text 3 : works with files and Git
#!/bin/bash
# To create in [.babun/]cygwin/usr/local/bin/subl with chmod +x
ARGS=""
while test $# -gt 0
do
ARGS="$ARGS ${1#/cygdrive/[a-zA-Z]}"; # Remove /cygdrive and disk letter from the path
shift
done
@nshtg
nshtg / docker.sh
Last active October 2, 2017 18:11
#!/usr/bin/env bash
set -e
export DISTRO_NAME=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
curl -fsSL https://download.docker.com/linux/$DISTRO_NAME/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$DISTRO_NAME $(lsb_release -cs) stable"
sudo apt-get update -y
sudo apt-get install -y docker-ce jq sed
sudo usermod -aG docker ${USER}
@nshtg
nshtg / nginx_libressl.sh
Last active September 11, 2024 06:29
Build nginx statically against modern OpenSSL/LibreSSL
#!/usr/bin/env bash
set -e
# names of latest versions of each package
export NGINX_VERSION=1.13.5
export VERSION_ZLIB=zlib-1.2.11
export VERSION_PCRE=pcre-8.41
export VERSION_LIBRESSL=libressl-2.6.1
export VERSION_NGINX=nginx-$NGINX_VERSION