Skip to content

Instantly share code, notes, and snippets.

@johan149
johan149 / ffmpeg_optimized_videos.md
Last active December 25, 2021 01:44
Convert HQ image sequences to h264/mp4 h265/mp4 ogv/theora & vp9/webm For Cross-Browser Compatibility
  • H264 CRF 17
ffmpeg -y -r 30 -f image2 -i "C:\Users\server\Downloads\meetmo\meetmo_2.0\auth\animations\bg\login_bg.%04d.png" -c:v libx264 -crf 17 -profile:v high -preset veryslow -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart -an "C:\Users\server\Downloads\meetmo\meetmo_2.0\auth\animations\login_bg_h264_crf17.mp4"
  • H264 CRF 23
ffmpeg -y -r 30 -f image2 -i "C:\Users\server\Downloads\meetmo\meetmo_2.0\auth\animations\bg\login_bg.%04d.png" -c:v libx264 -crf 23 -profile:v high -preset veryslow -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart -an "C:\Users\server\Downloads\meetmo\meetmo_2.0\auth\animations\login_bg_h264_crf23.mp4"
  • H264 CRF 25
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
@johan149
johan149 / inet
Last active January 25, 2023 07:34
#!/bin/sh
# get internal IP, mac address, and public ip
# To install run the following
# sudo wget -qO /usr/local/bin/inet https://gist.githubusercontent.com/johan149/0598c69f193f34058cf77fa3c3b68551/raw/efcdcc0e0a8862e7de68f244af2cb0a20e33e06a/inet && sudo chmod a+x /usr/local/bin/inet
#to run just type and hit enter 'inet'
echo 'eno1'
eth1=eno1
# This file is copied from: https://github.com/k4yt3x/simple-http-server/blob/master/Dockerfile
# LICENS: BSD 2-Clause "Simplified" License
# please see https://github.com/k4yt3x/simple-http-server/blob/master/LICENSE for more details
FROM rust:1.61-alpine3.15 as builder
# branch name or tag
ARG BRANCH
RUN apk add --no-cache --virtual .build-deps git make musl-dev openssl-dev perl pkgconfig \
&& git clone -b $BRANCH https://github.com/TheWaWaR/simple-http-server.git /simple-http-server \
&& RUSTFLAGS='-C link-arg=-s' cargo build \
# run this on the clean CLI
# bash <(curl -sL https://gist.githubusercontent.com/johan149/98604b831521a6c2435bfb74eacf075e/raw/7601555f22c12d8bce2854d4975d14a326dd16bd/install_docker.sh)
# install docker
sudo apt update
sudo apt -y install apt-transport-https ca-certificates curl software-properties-common aria2
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
apt-cache policy docker-ce
@johan149
johan149 / sping
Last active January 26, 2023 08:58
#!/bin/bash
# to use run the following
# wget -qO - https://gist.githubusercontent.com/johan149/754f95421610f62f585d863f216e0b23/raw/2578b078826e66c59e0bb68384c67aac67f0016d/sping | bash
declare -a list
list[0]=nj-us-ping.vultr.com
list[1]=il-us-ping.vultr.com
list[2]=ga-us-ping.vultr.com
@johan149
johan149 / cping
Last active January 26, 2023 09:07
#!/bin/bash
printf "Vultr/Choopa Ping Test:\n\n"
# https://www.vultr.com/resources/faq/#downloadspeedtests
for DC in NJ-US IL-US GA-US FL-US TX-US HON-HI-US SJO-CA-US LAX-CA-US MEX-MX WA-US TOR-CA FRA-DE AMS-NL PAR-FR LON-GB MEL-AU SYD-AU SGP HND-JP SEL-KOR JNB-ZA BLR-IN DEL-IN BOM-IN OSK-JP MAD-ES STO-SE WAW-PL SCL-CL SAO-BR
do
printf "$DC: \t$(ping -i .2 -c 10 -q $DC-ping.vultr.com | awk -F/ '/^round|^rtt/{print $5}') ms\n" | expand -t 20
done
@johan149
johan149 / ping.py
Last active January 26, 2023 09:58
import urllib.request, subprocess, json, time, sys, re
pings = 1
batchSize = 100
mode = "ipv4"
target = ""
if len(sys.argv) >= 2:
args = re.findall("((-c|-p|-l)\s?([0-9A-Za-z]+)|-6)",' '.join(sys.argv[1:]))
for arg in args:
#!/bin/bash
check_internet_connection() {
return $(ping -c 1 www.google.com > /dev/null)
}
while [ 1 ]; do
check_internet_connection
# already have internet connection
if [ $? -eq 0 ]; then
echo "$(date +%Y-%m-%d\ %H:%M:%S) "internet connection state online"