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 / 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 / install_local_conda_package.sh
Created December 26, 2018 03:40
Install local conda package, by using tar.bz2 format, install package locally and no dependency
# Use tensorflow from conda-forge for testing
# By using this, we can install tensorflow without network
# Ref https://anaconda.org/conda-forge/tensorflow/files
conda install --use-local tensorflow-1.10.0-py36_0.tar.bz2 --no-deps
@cftang0827
cftang0827 / gist:5b7430f9ea4364944ff3f9a4eaf70270
Created December 26, 2018 03:43
get wheel package from pip remote server
pip wheel --wheel-dir=./ numpy==1.12 --no-deps
@cftang0827
cftang0827 / gopsutil_example.go
Created April 26, 2019 08:24
The example of gopsutil, get the info of CPU memory and disk
import (
"fmt"
"net/http"
"os"
"time"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/mem"
@cftang0827
cftang0827 / remove_empty_string.py
Created August 30, 2019 05:53
The simple script to replace empty value in json to null
def remove_empty_string(dic):
"""
Replace empty string to None
"""
for e in dic:
if isinstance(dic[e], dict):
dic[e] = remove_empty_string(dic[e])
if (isinstance(dic[e], str) and dic[e] == ""):
dic[e] = None
if isinstance(dic[e], list):
version: 2
jobs:
build:
working_directory: ~/circleci-demo-ruby-rails
# Primary container image where all commands run
docker:
- image: circleci/ruby:2.4.1-node
environment:
@cftang0827
cftang0827 / example-circleci-config.yml
Created January 8, 2020 05:29
example circleci config
version: 2
jobs:
build:
working_directory: /test_app
parallelism: 1
docker:
- image: docker/compose:1.25.0-rc2-debian
steps:
- run:
name: Configure environment
@cftang0827
cftang0827 / docker-compose-yml-sample.yml
Created January 8, 2020 05:31
docker-compose yaml sample for circleci building
version: "3"
services:
db:
image: mysql:5.7
restart: always
container_name: db
ports:
- "3306:3306"
environment:
@cftang0827
cftang0827 / docker-compose-yml-sample-2.yml
Created January 8, 2020 05:33
docker-compose-circleci-sample-2
version: "3"
services:
db:
image: mysql:5.7
restart: always
container_name: db
ports:
- "3306:3306"
environment:
@cftang0827
cftang0827 / docker-compose-yml-sample-3.yml
Created January 8, 2020 05:35
docker compose circleci sample 3
version: "3"
services:
db:
image: mysql:5.7
restart: always
container_name: db
ports:
- "3306:3306"
environment: