Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
What's happening?

Allan Lei allanlei

:shipit:
What's happening?
View GitHub Profile
View publish.py
import paho.mqtt.client as mqtt
client = mqtt.Client(protocol=mqtt.MQTTv311)
client.connect('iot.eclipse.org', port=1883, keepalive=60)
client.publish('update', 'hello world')
@allanlei
allanlei / gist:8ea15ceeae93447f7212
Created Jul 16, 2014
Running twisted application without twistd
View gist:8ea15ceeae93447f7212
from twisted.web.resource import Resource
from twisted.internet import reactor
from twisted.web.static import File
from twisted.web import server
from twisted.application import internet, service
from twisted.application.app import startApplication
from twisted.web.wsgi import WSGIResource
from twisted.runner.procmon import ProcessMonitor
from twisted.web import vhost, static
@allanlei
allanlei / daemonset-preloaded.yaml
Created Jun 26, 2020
Custom Driver Install for NVIDIA on GKE
View daemonset-preloaded.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: nvidia-driver-installer-cos
namespace: kube-system
labels:
k8s-app: nvidia-driver-installer-cos
spec:
selector:
matchLabels:
@allanlei
allanlei / ffmpeg-scale-npp
Created Jun 26, 2020
FFMPEG using scale_npp
View ffmpeg-scale-npp
ffmpeg \
-vsync 0 \
-hwaccel cuvid -c:v h264_cuvid \
-i https://twitch-event-engineering-public.s3.amazonaws.com/sync-footage/Sync-Footage-V1-H264.mp4 \
-filter_complex " \
[0:v]scale_npp=1280:720[out]
" -map '[out]' -y -c:v h264_nvenc -y output.mp4
@allanlei
allanlei / ffmpeg-blurout.sh
Last active Sep 7, 2019
FFmpeg Filtergraph to generate Blur Out
View ffmpeg-blurout.sh
ffmpeg -i source.mp4 -filter_complex \
"[0:v]split=2[base][blurred]; \
[blurred]boxblur=luma_radius=50:chroma_radius=25:luma_power=1[blurred]; \
[blurred]fade=type=in:start_time=5:duration=1:alpha=1[blurred-with-fadein]; \
[base][blurred-with-fadein]overlay[blurout]" \
-map "[blurout]" blurout.mp4
@allanlei
allanlei / filter-complex-fadein.sh
Last active Sep 7, 2019
FFmpeg Filtergraph to fade in a video
View filter-complex-fadein.sh
ffmpeg -i source.mp4 -filter_complex \
"[0:v]fade=type=in:start_time=1:duration=8[fadein]" \
-map "[fadein]" fadein.mp4
@allanlei
allanlei / filter-complex-blur.sh
Last active Sep 7, 2019
FFmpeg Filtergraph to blur a video
View filter-complex-blur.sh
ffmpeg -i source.mp4 -filter_complex \
"[0:v]boxblur=luma_radius=10:chroma_radius=10:luma_power=1[blurred]" \
-map "[blurred]" blurred.mp4
@allanlei
allanlei / filter-complex-split.sh
Created Sep 7, 2019
FFmpeg Filtergraph to split inputs (with scaling)
View filter-complex-split.sh
ffmpeg -i source.mp4 -filter_complex \
"[0:v]split=2[360p][720p]; \
[360p]scale=-2:360[360p]; \
[720p]scale=-2:720[720p]" \
-map "[360p]" 360p.mp4 \
-map "[720p]" 720p.mp4
@allanlei
allanlei / daemonset.yaml
Last active Sep 2, 2019
Kubernetes sysctl daemonset for tuning Transparent Huge Pages
View daemonset.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
namespace: kube-system
name: sysctl
spec:
selector:
matchLabels:
app: sysctl
template:
View stunnel.conf
#STUNNEL CONFIG
client = yes
[postgres-serverB]
protocol = pgsql
accept = 0.0.0.0:5432 # host:port to listen to on serverA
connect = SERVER_B_POSTGRES_HOST:SERVER_B_POSTGRES_PORT
options = NO_TICKET
retry = yes