Skip to content

Instantly share code, notes, and snippets.

View cftang0827's full-sized avatar
🏠
Playing~

Paul Tang cftang0827

🏠
Playing~
View GitHub Profile
@cftang0827
cftang0827 / gist:35b12be7133a36a3cc7d5dabbdc52762
Created July 9, 2018 07:00 — forked from thinkphp/gist:1450738
Binary Search Tree implementation in Python
'''
by Adrian Statescu <adrian@thinkphp.ro>
Twitter: @thinkphp
G+ : http://gplus.to/thinkphp
MIT Style License
'''
'''
Binary Search Tree
------------------
@cftang0827
cftang0827 / .vimrc
Created November 18, 2018 16:06 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@cftang0827
cftang0827 / ffmpeg4matelight.sh
Created November 28, 2018 05:58 — forked from MichaelKreil/ffmpeg4matelight.sh
using ffmpeg to stream videos, gifs, the webcam or the screen to matelight
# Stream a video
ffmpeg -re -i video.avi -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
# Loop a gif
ffmpeg -re -ignore_loop 0 -i image.gif -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
# Stream webcam
# Mac
ffmpeg -re -f avfoundation -r 30 -s 1280x720 -i "0" -vf "scale=40:ih*40/iw, crop=40:16, pp=autolevels:f, eq=1.5" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
@cftang0827
cftang0827 / promises
Created February 28, 2020 02:36 — forked from kuanhsuh/promises
callback vs promises
function logWord(word){
setTimeout(function() {
console.log(word)
}, Math.floor(Math.random() * 100) + 1
// return value between 1 ~ 100
)
}
function logAll(){
logWord("A")