Skip to content

Instantly share code, notes, and snippets.

View jidckii's full-sized avatar

Evgeniy Medvedev jidckii

View GitHub Profile
@lcrilly
lcrilly / README.md
Last active November 23, 2024 18:09
Prometheus exporter for NGINX Unit metrics

Prometheus exporter for NGINX Unit metrics

The NGINX Unit control API includes a /status endpoint for usage statistics. This is a solution for exposing these metrics in Prometheus format.

The application (run by Unit) queries the /status URI on the control socket and converts the JSON response into Prometheus text format. PHP and Python implementations are available.

These instructions assume an existing Unit installation with a working configuration. We will add a new listener on the default prometheus port (9090) and route it directly to the Prometheus app.

Step 0. Install the preferred Unit language module (unit-php or unit-python)

import json
import boto3
import requests
from datetime import datetime, timedelta
CLIENT = boto3.client('ce')
SLACK_WEBHOOK_URL = '' # Enter the slack webhook url.
def lambda_handler(event, context):
@tclh123
tclh123 / migrate-pv-to-zone.sh
Created March 10, 2021 08:24
Migrate EBS Volume based PVs across AWS availability zones (ref. https://gist.github.com/caruccio/be825aa39d53535217494369cc793dbd)
#!/bin/bash
set -eu
NAMESPACE=$1
PVCNAME=$2
TARGETZONE=$3
# SNAPSHOTID is optional, if you did a snapshot already, you can pass it
SNAPSHOTID=${4:-}
@gfodor
gfodor / ffmpeg-minimalist-build-nvenc-static.md
Last active January 20, 2023 14:55
Static FFmpeg build on Ubuntu 16.04 with Nvidia NVENC enabled.

Minimalist static FFmpeg build on Ubuntu 18.10 with Nvidia NVENC enabled.

Original guide with a standard build is here.

With this guide, I'm adding more instructions to enable support for NVIDIA CUVID and NVIDIA NPP for enhanced encode and decode performance.

First, prepare for the build and create the work space directory:

cd ~/

@trautonen
trautonen / fish_prompt
Created April 26, 2018 15:00
Terraform workspaces in fish shell
# Edit your fish prompt with `funced fish_prompt` and
# add the following to a desired place in the function.
# Save the prompt after editing with `funcsave fish_prompt`.
# Set a variable for workspace color.
set -l tfworkspace_color (set_color green)
# Append the workspace name at the current prompt position if
# the directory contains a .terraform subdirectory
if test -d .terraform
@kiki67100
kiki67100 / ffmpeg_hardware_acceleration_h264_videotoolbox.bash
Created July 25, 2017 08:15
ffmpeg hardware accelaration mac os
#!/bin/bash
#Verify the quality with difference bitrate ( crf no work with h264_videotoolbox use -b:v )
#You can use the same audio codec change -c:a ac3 to -c:a copy i use it because it work my multimedia player
for bitrate in 500k 1000k 1500k 2500k 3000k 3500k;do
ffmpeg -i Movie.mkv -c:v h264_videotoolbox -c:a ac3 -b:a 128k -y -b:v $bitrate -ss 00:01:00 -t 00:00:10 Movie_$bitrate.mp4;
done
#With 2500k bitrate
ffmpeg -i Movie.mkv -c:v h264_videotoolbox -c:a ac3 -b:a 128k -y -b:v $bitrate -b:a 128k Movie_$bitrate.mp4;
@Brainiarc7
Brainiarc7 / ffmpeg-vp8&9-encode-test-vaapi-intel.md
Last active January 9, 2025 05:19
PSA: You can now use FFmpeg's VAAPI-based VP8 and VP9 encoder on Skylake+ systems on Linux: Tested on Ubuntu 16.04LTS

Build VAAPI with support for VP8/9 decode and encode hardware acceleration on a Skylake validation testbed:

Build platform: Ubuntu 16.04LTS.

First things first:

Install baseline dependencies first

sudo apt-get -y install autoconf automake build-essential libass-dev libtool pkg-config texinfo zlib1g-dev libva-dev cmake mercurial libdrm-dev libvorbis-dev libogg-dev git libx11-dev libperl-dev libpciaccess-dev libpciaccess0 xorg-dev intel-gpu-tools

@w495
w495 / pyav_rtmp_example.py
Last active June 15, 2019 21:15
Пример работы с видео в Python. Есть RTMP-поток и RTMP-сервер, на который нужно отправить этот поток. Создано по мотивам https://ru.stackoverflow.com/a/664973/203032
# -*- coding: utf8 -*-
import av
# Откроем ресурс на чтение
input_resource = av.open(
'rtmp://src_stream:1935/play'
)
# Откроем ресурс на запись.
output_resource = av.open(
@ekwoodrich
ekwoodrich / DVRIP-Sonia Reference Codes.md
Last active January 18, 2025 19:15
Reference codes for the DVRIP/Sonia TCP protocol used by the Net Surveillance ActiveX plugin

DVRIP/Sonia Protocol

DVRIP/Sonia TCP protocol used by the Net Surveillance ActiveX plugin

1. Response Codes

Return code Definition
100 Success
101 Unknown error
102 Version not supported
103 Illegal request
@Jiab77
Jiab77 / ffmpeg.md
Last active June 27, 2024 21:14
This gist will help you to compile ffmpeg with NVENC, QSV, VAAPI, VDPAU, and OpenCL support.

Compilation FFMpeg / NVENC + NVRESIZE + QSV + VAAPI + VDPAU + OpenCL

This gist will help you to compile ffmpeg with NVENC, QSV, VAAPI, VDPAU, and OpenCL support.

nVidia nvresize patch is outdated and not more compatible to the latest version of FFmpeg, so it's not included in this documentation.

(even if I've passed a lot of time at trying to make it compile... without any success)

Please don't rely on this page: https://developer.nvidia.com/ffmpeg, the implementation is a hack and was never been added to the main FFmpeg tree.