Skip to content

Instantly share code, notes, and snippets.

View apacheservices68's full-sized avatar
🌴
On vacation

Vinh Banh apacheservices68

🌴
On vacation
View GitHub Profile
@apacheservices68
apacheservices68 / Logitech URLs
Created August 16, 2024 07:42 — forked from trungbtran/Logitech URLs
List of Logitech URLs
https://www.logitech.com/tr-tr/product/multimedia-speakers-z333
https://www.logitech.com/cs-cz/product/multimedia-speakers-z333
https://www.logitech.com/en-au/product/z333-speaker-system-subwoofer.html
https://www.logitech.com/en-nz/product/z333-speaker-system-subwoofer.html
https://www.logitech.com/ru-ru/product/multimedia-speakers-z333
https://www.logitech.com/da-dk/product/multimedia-speakers-z333
https://www.logitech.com/sv-se/product/multimedia-speakers-z333
https://www.logitech.com/no-no/product/multimedia-speakers-z333
https://www.logitech.com/es-es/product/multimedia-speakers-z333
https://www.logitech.com/en-gb/product/z333-speaker-system-subwoofer.html
@apacheservices68
apacheservices68 / Logitech URLs
Created August 16, 2024 07:42 — forked from trungbtran/Logitech URLs
List of Logitech URLs
https://www.logitech.com/tr-tr/product/multimedia-speakers-z333
https://www.logitech.com/cs-cz/product/multimedia-speakers-z333
https://www.logitech.com/en-au/product/z333-speaker-system-subwoofer.html
https://www.logitech.com/en-nz/product/z333-speaker-system-subwoofer.html
https://www.logitech.com/ru-ru/product/multimedia-speakers-z333
https://www.logitech.com/da-dk/product/multimedia-speakers-z333
https://www.logitech.com/sv-se/product/multimedia-speakers-z333
https://www.logitech.com/no-no/product/multimedia-speakers-z333
https://www.logitech.com/es-es/product/multimedia-speakers-z333
https://www.logitech.com/en-gb/product/z333-speaker-system-subwoofer.html
@apacheservices68
apacheservices68 / ffmpeg -h decoder=h264_cuvid
Created February 20, 2024 04:19 — forked from nakov/ffmpeg -h decoder=h264_cuvid
ffmpeg: NVidia hardware encoder `h264_nvenc` and hardware decoder `h264_cuvid` - Documentation (Nov 2020)
ffmpeg version 2020-11-29-git-f194cedfe6-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable

Sometimes you want to retrieve EC2 insntances' region information.

You can query that information through instance metadata(169.254.169.254).

$ curl --silent http://169.254.169.254/latest/dynamic/instance-identity/document
{
  "privateIp" : "172.31.2.15",
  "instanceId" : "i-12341ee8",
  "billingProducts" : null,
 "instanceType" : "t2.small",
@apacheservices68
apacheservices68 / awscli_v2_ubuntu.md
Created September 7, 2023 10:42 — forked from ruanbekker/awscli_v2_ubuntu.md
Install AWS CLI Version 2 on Ubuntu 20
$ apt update
$ apt search awscli
$ apt install curl wget unzip -y
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
$ unzip awscliv2.zip
$ ./aws/install
$ aws --version
aws-cli/2.1.28 Python/3.8.8 Linux/4.19.121-linuxkit exe/x86_64.ubuntu.20 prompt/off
@apacheservices68
apacheservices68 / main.go
Created February 19, 2023 15:56 — forked from ayoisaiah/main.go
Multipart requests in Go (feat Google Drive API)
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"net/textproto"
@apacheservices68
apacheservices68 / ffmpeg-multi-instances-xargs.md
Created February 13, 2023 03:57 — forked from Brainiarc7/ffmpeg-multi-instances-xargs.md
This gist will show you how to launch multiple ffmpeg instances with xargs, very useful for NVIDIA NVENC based encoding where standard GPUs limit the maximum simultaneous encode sessions to two.

Spawning multiple ffmpeg processes with xargs:

On standard NVIDIA GPUs (Not the Quadros and Tesla lines), NVENC encodes are limited to two simultaneous sessions. The sample below illustrates how to pass a list of AVI files to ffmpeg and encode them to HEVC on two encode sessions:

$ find Videos/ -type f -name \*.avi -print | sed 's/.avi$//' |\
  xargs -n 1 -I@ -P 2 ffmpeg -i "@.avi" -c:a aac -c:v hevc_nvenc "@.mp4"

This will find all files with the ending .avi in the directory Videos/ and transcode them into HEVC/H265+AAC files with the ending .mp4. The noteworthy part here is the -P 2 to xargs, which starts up to two processes in parallel.

FFmpeg Cheatsheet for video ML practitioners

Dump single frame from a video:

$ ffmpeg -ss 0.5 -i in.mp4 -t 1 -s 1920x1080 -f image2 out.jpg
# -ss specifies the start position in seconds, or timestamp
# -t the number of frames, in this case 1
# -s size of output
# -f image2 forces image output
@apacheservices68
apacheservices68 / errgroup_withcontext.go
Created December 28, 2022 10:01 — forked from dragonsinth/errgroup_withcontext.go
Using errgroup.WithContext() in Golang server handlers
package main
import (
"context"
"encoding/json"
"fmt"
"io"
"log"
"sync/atomic"
"time"

High Availability (HA) - Khả năng đáp ứng cao

HA có thể được hiểu là:

  1. Một hệ thống có khả năng phục vụ liên tục
  2. Chịu nhiệt cao (tức là khi nhiều người yêu cầu phục vụ thì vẫn có thể chạy ổn định).

Bài viết này ta sẽ tập trung vào mục (1).

Redis replication

Là phương pháp sử dụng "lính dự bị", lên đảm nhiệm vai trò của "lính chủ lực" khi ông chủ lực kiệt sức chết.