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
@lsiden
lsiden / gist:260167a4d3574a580d97
Last active February 7, 2018 17:53
module ActiveRecord::UnionScope
#https://gist.github.com/tlowrimore/5162327
#http://stackoverflow.com/a/15413611/270511
module ActiveRecord::UnionScope
def self.included(base)
base.send :extend, ClassMethods
end
module ClassMethods
def union_scope(*scopes)
@lsiden
lsiden / TestAnnouncementsController.php
Created August 9, 2012 14:53
Test AnnouncementsController::isAuthorized()
<?php
App::uses('AnnouncementsController', 'Controller');
class MockAnnouncementsController extends AnnouncementsController {
var $name = 'Announcements';
var $autoRender = false;
/*
function redirect($url, $status = null, $exit = true) {
$this->redirectUrl = $url;
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