Skip to content

Instantly share code, notes, and snippets.

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 December 31, 2023 02: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 April 30, 2024 20:24
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.

@takeshixx
takeshixx / ubuntu-xenial-armfh-qemu.md
Last active October 22, 2023 12:14
Running Ubuntu 16.04.1 armhf on Qemu

Running Ubuntu 16.04.1 armhf on Qemu

This is a writeup about how to install Ubuntu 16.04.1 Xenial Xerus for the 32-bit hard-float ARMv7 (armhf) architecture on a Qemu VM via Ubuntu netboot.

The setup will create a Ubuntu VM with LPAE extensions (generic-lpae) enabled. However, this writeup should also work for non-LPAE (generic) kernels.

The performance of the resulting VM is quite good, and it allows VMs with >1G ram (compared to 256M on versatilepb and 1G on versatile-a9/versatile-a15). It also supports virtio disks whereas versatile-a9/versatile-a15 only support SD cards via the -sd argument.

Get netboot files