Skip to content

Instantly share code, notes, and snippets.

View lsiden's full-sized avatar

Lawrence Siden lsiden

View GitHub Profile
@lsiden
lsiden / gist:c91b72e67d8150819aacf1a3993979ca
Created June 4, 2021 15:47
Decorator to gzip Respone payload
"""Decorator to gzip Respone payload
Obtained from http://kb.sites.apiit.edu.my/knowledge-base/how-to-gzip-response-in-flask/
Example use case:
@gzipped
def get_data():
return response
"""
#!/usr/bin/env bash
# Make CPAN package.
# Usage: mkcpanpkg $dirname
# Run this in the parent directory of $dirname.
# $dirname must be a Git repository.
# It will create a file $dirname-$version.tar.gz containing all files tracked by Git.
function modname() {
perl -e "print join(q{::}, split(/-/, qw{$1}))"
@lsiden
lsiden / web-hybrid-solutions.md
Last active April 5, 2018 17:03
React Native - Web hybrid solutions
const path = require('path')
module.exports = {
target: 'web',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
publicPath: 'dist',
library: 'Alc',
libraryTarget: 'umd',
const path = require('path')
module.exports = {
target: 'web',
entry: {
app: ['./demo/index.jsx']
},
devServer: {
contentBase: './demo/',
},
@lsiden
lsiden / gist:649d8ef9e02758ffde30b2b10fbac45a
Created March 17, 2017 21:15
Gst control source demo
#!/usr/bin/python
import gi
import sys
import threading
import time
from gi.repository import GObject
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GstController, GLib
def get_alpha_controller(pad):
2017-03-16 20:45:04,864, hls.py, DEBUG, hls.py, 72, videomixer name=mixer sink_0::zorder=0 sink_1::zorder=99
! videoconvert
! x264enc
! mpegtsmux name=muxer
! hlssink playlist-root=/hls-test
playlist-location=/tmp/hlsstreams/hls-test/playlist.m3u8
location=/tmp/hlsstreams/hls-test/seg%05d.ts
playlist-length=999
max-files=999
target-duration=3
@lsiden
lsiden / gist:c66ed5f35a00657c9225d1dc04f07b0c
Created March 13, 2017 20:42
Gst Pipeline demo with control source bound to 'alpha' property of videomixer sink
#!/usr/bin/python
import sys
import threading
import time
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject
from gi.repository import Gst, GstController, GLib
#!/usr/bin/python
import gi
import sys
from gi.repository import GObject
gi.require_version('Gst', '1.0')
from gi.repository import Gst
from gi.repository import GstController
from gi.repository import GLib
GObject.threads_init()
@lsiden
lsiden / gist:11ee113b0798e19a255e5a88d9c984e3
Created October 19, 2016 15:35
Output of 'vagrant provision'
==> moc-local2: Error: Execution of '/usr/local/rvm/bin/rvm install 2.3 ' returned 1: Searching for binary rubies, this might take some time.
==> moc-local2: Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/16.04/x86_64/ruby-2.3.0.tar.bz2
==> moc-local2: Checking requirements for ubuntu.
==> moc-local2: Installing requirements for ubuntu.
==> moc-local2: Updating system.........
==> moc-local2: Error running 'requirements_debian_update_system ruby-2.3.0',
==> moc-local2: showing last 15 lines of /usr/local/rvm/log/1476890187_ruby-2.3.0/update_system.log
==> moc-local2: ++ case "${TERM:-dumb}" in
==> moc-local2: ++ case "$1" in
==> moc-local2: ++ [[ -t 2 ]]