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 / 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 / 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 / pppoe.service
Created November 23, 2018 19:24
systemd for pppoe pon network connection
[Unit]
Description=pppoe
[Service]
Type=simple
WorkingDirectory=/usr/bin/
ExecStart=/usr/bin/pon dsl-provider
Restart=always
[Install]
ffmpeg -f avfoundation -framerate 30 -s 1280x720 -i "1" -b:v 1M -preset ultrafast -s 1280x720 -r 30 test.mp4
@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
import time
import threading
class p:
def __init__(self):
self.flag = True
self.thread = threading.Thread(target=self.show)
self.thread.start()
def show(self):
<html>
<head>
<script>
function show_image() {
document.getElementById("show").setAttribute("src", "data:image/jpeg;base64," + document.getElementById('base64_img').value);
}
</script>
</head>
<h1> Base64 encoding</h1>
ffmpeg -i /dev/video0 -c:v libx264 -b:v 1M -preset ultrafast -s 1280x720 -r 30 test.mp4
{
"protocol": "sftp",
"host": "ip_address",
"port": 22,
"username": "cftang",
"remotePath": "remote_path",
"privateKeyPath": "/Users/cftang/.ssh/id_rsa",
"passphrase": "/Users/cftang/.ssh/id_rsa.pub",
"uploadOnSave": true,
"ignore": [
@cftang0827
cftang0827 / rpi_cpu_temp_monitor.py
Created July 26, 2018 04:25
A script that can measure rpi's temperature and clock speed
# coding=UTF-8
'''
Python rpi monitor program
Call vcgencmd in shell and get the temp info and cpu clock info
20180314
'''
import subprocess as sub
import time