Skip to content

Instantly share code, notes, and snippets.

View DipandaAser's full-sized avatar
😁
Compile...

Dipanda Aser DipandaAser

😁
Compile...
View GitHub Profile
@johnlpage
johnlpage / gist:2e8bd55ed195cccd4af7cea718f1c640
Last active February 25, 2024 05:26
Examples for MongoDB Atlas Data API Video
ENDPOINT
--------
https://data.mongodb-api.com/app/data-amzuu/endpoint/data/beta
API KEY
--------
0vaT8d5Vh9cgvm3KdIQJWkl5M8alZgnoOczmApFlWVTMqisg24QWrUfMS0wkQ5Sj
@DipandaAser
DipandaAser / replace.js
Last active May 31, 2021 11:14
Replace substring in mongodb documents using NosqlBooster
db.File.find({}).forEach(function(document) {
if (document.PublicLink.startsWith("http")) {
document.PublicLink = document.PublicLink.replace("http", "https")
}
db.File.save(document)
})
@DipandaAser
DipandaAser / collectionPreRequestScript.js
Created April 21, 2021 10:27
Automate login and re-login to refresh token
var moment = require('moment');
var tokenExpirationDate = pm.collectionVariables.get("token-expiration-date");
var currentTime = moment().format();
if ( (tokenExpirationDate === "") || (currentTime >= tokenExpirationDate) ){
pm.sendRequest({
url: pm.collectionVariables.get("local-url") + '/login',
method: 'POST',
@SkYNewZ
SkYNewZ / Caddyfile
Created October 7, 2020 17:13
Example Caddyfile for using as load balancer
{
# Enable Debug mode
debug
# Disable admin API
admin off
}
localhost {
# https://caddyserver.com/docs/caddyfile/directives/push
@Andrey2G
Andrey2G / encoding.txt
Last active June 13, 2024 07:55
Video Encoding with multiple resolutions
ffmpeg -i "c:/videos/sample.mp4
-map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0
-c:v libx264 -crf 22 -c:a aac -ar 48000
-filter:v:0 scale=w=480:h=360 -maxrate:v:0 600k -b:a:0 64k
-filter:v:1 scale=w=640:h=480 -maxrate:v:1 900k -b:a:1 128k
-filter:v:2 scale=w=1280:h=720 -maxrate:v:2 900k -b:a:2 128k
-var_stream_map "v:0,a:0,name:360p v:1,a:1,name:480p v:2,a:2,name:720p"
-preset slow -hls_list_size 0 -threads 0 -f hls -hls_playlist_type event -hls_time 3
-hls_flags independent_segments -master_pl_name "name-pl.m3u8"
"c:/videos/encoded/name-%v.m3u8"
@kowalcj0
kowalcj0 / .bashrc
Last active July 30, 2023 10:09
Extract all subtitles from a movie using ffprobe & ffmpeg
alias subs=subs
function subs() {
movie="${1}"
filename="${1%.*}"
mappings=`ffprobe -loglevel error -select_streams s -show_entries stream=index:stream_tags=language -of csv=p=0 "${movie}"`
OLDIFS=$IFS
IFS=,
( while read idx lang
do
@recoilme
recoilme / checkTelegramAuthorization.go
Created February 14, 2018 07:32
Check Telegram Authorization in golang
// check telegram authorization on golang
//php version: https://gist.github.com/anonymous/6516521b1fb3b464534fbc30ea3573c2#file-check_authorization-php
//usage:
/*
func TestTg(t *testing.T) {
data := "id=1263310&first_name=Vadim&last_name=Kulibaba&username=recoilme&photo_url=https://t.me/i/userpic/320/recoilme.jpg&auth_date=1518535618&hash=1d7069137bf517a63261ee156919a057dca93a416118eebfd0d8f5697442cdce"
token := "YOUR:TOKEN"
if !checkTelegramAuthorization(data, token) {
t.Fail()
}
@asukakenji
asukakenji / 0-go-os-arch.md
Last active July 18, 2024 06:42
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@s4y
s4y / capture_hls.md
Last active June 29, 2024 11:56
Capture an HLS stream from the beginning with ffmpeg
ffmpeg -live_start_index -99999 -i 'https://….m3u8' -c copy something.ts

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8