Skip to content

Instantly share code, notes, and snippets.

View bugre's full-sized avatar

Werner [wm] bugre

  • South Brazil
View GitHub Profile
@bugre
bugre / haproxy-cors.md
Last active May 23, 2023 18:13 — forked from nasrulhazim/haproxy-cors.md
Setting Up CORS in HAProxy

The "Credentials" is important if you're using Authentication..

frontend localnodes
    bind *:80
    reqadd X-Forwarded-Proto:\ http

    # Add CORS headers when Origin header is present
    capture request header origin len 128
    http-response add-header Access-Control-Allow-Origin %[capture.req.hdr(0)] if { capture.req.hdr(0) -m found }
@bugre
bugre / app.js
Created April 27, 2022 12:15 — forked from satori99/app.js
This is a proof-of-concept for using ffmpeg as a HTTP video stream proxy that can reduce the volume of ad-breaks
/**
* This is a proof-of-concept for using ffmpeg as a HTTP video stream proxy
* that can reduce ad volume.
*
* It only works on streams containing SCTE35 data packets.
* You can check a stream using:
*
* ffmpeg -hide_banner -i <SOURCE_URL> 2>&1 | grep scte_35
*
* Start the demo:
@bugre
bugre / python-ffmpeg.py
Created March 15, 2022 10:59 — forked from hiwonjoon/python-ffmpeg.py
ffmpeg and ffprobe subprocess call in python; extract specific frame at some timepoint, extract duration of a video
import subprocess
import datetime
import numpy as np
THREAD_NUM=4
def get_video_info(fileloc) :
command = ['ffprobe',
'-v', 'fatal',
'-show_entries', 'stream=width,height,r_frame_rate,duration',
@bugre
bugre / ubuntu-racadm-install.sh
Last active March 20, 2023 19:19
Ubuntu (20.04) install racadm and ipmitool
sudo apt-get install gpg libssl-dev
## the default "sudo gpg --keyserver pool.sks-keyservers.net --recv-key 1285491434D8786F" fails.. pool.sks-keyservers.net is having problems...
gpg --keyserver keyserver.ubuntu.com --recv-key 1285491434D8786F && gpg -a --export 1285491434D8786F | sudo apt-key add -
echo 'deb http://linux.dell.com/repo/community/openmanage/932/bionic bionic main' | sudo tee -a /etc/apt/sources.list.d/linux.dell.com.sources.list
sudo apt-get update
sudo apt-get install srvadmin-idracadm8
sudo apt install ipmitool
@bugre
bugre / README.md
Created March 2, 2022 02:11 — forked from mikoim/README.md
[Updated! Aug 14 2020] YouTube recommended encoding settings on ffmpeg (+ libx264)

Parameters

Container: MP4

Parameter YouTube recommends setting
-movflags faststart moov atom at the front of the file (Fast Start)

Video codec: H.264

@bugre
bugre / clean-dedup-bash-history.sh
Last active March 2, 2022 00:42
Bash history deduplicate / simplify / cleanup
## ATTENTION: Complete purges history.. make a backup if you want..
# Clear bash history file and loaded history.
> ~/.bash_history && history -c
## deduplicate
## add to ~/.bashrc && ~/.bash_profile
HISTCONTROL=ignoreboth:erasedups
HISTCONTROL=ignoreboth:erasedups
HISTSIZE=50000
@bugre
bugre / project.json
Created January 5, 2021 09:41 — forked from TsuyoshiUshio/project.json
Storage migration from Google Cloud Storage to Azure with Async/Await
{
"frameworks": {
"net46":{
"dependencies": {
"Google.Cloud.Storage.V1": "1.0.0-beta05"
}
}
}
}
@bugre
bugre / CSCubeBGRA.cc
Created September 22, 2020 13:54 — forked from victusfate/CSCubeBGRA.cc
decode a video with libav/ffmpeg
#include "CSCubeBGRA.h""
#include <sstream>
#include <cmath>
int getNearestIndexForTime(const vector<double> &times, double rTime)
{
// binary search
// returns an iterator pointing to the first element in the range [first,last) which does not compare less than val.
auto pFrameIndex = lower_bound(times.begin(),times.end(),rTime);
# ## may fail because no apt-tansport-https... go ahead.
# sudo apt-get update
# sudo apt-get dist-upgrade -y
# requires apt-transport-https
sudo apt-get install apt-transport-https -y
# get docker apt repo
sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo echo "deb https://apt.dockerproject.org/repo debian-jessie main" | sudo tee /etc/apt/sources.list.d/docker.list
@bugre
bugre / Time-based-auto-scaling-on-fargate.md
Created February 2, 2020 21:16 — forked from toricls/Time-based-auto-scaling-on-fargate.md
Example: Time-based Auto Scaling on Amazon ECS + AWS Fargate

Set parameters

$ export ECS_CLUSTER_NAME={YOUR_ECS_CLUSTER_NAME}
$ export ECS_SERVICE_NAME={YOUR_ECS_SERVICE_NAME}

RegisterScalableTarget