Skip to content

Instantly share code, notes, and snippets.

View chenkaie's full-sized avatar
:octocat:
Build Something...

Kent Chen chenkaie

:octocat:
Build Something...
View GitHub Profile
@chenkaie
chenkaie / results.txt
Created May 5, 2018 07:19 — forked from bnoordhuis/results.txt
show difference between mmap() and malloc()
$ gcc -DUSE_MMAP=0 tmp/rss.c && ./a.out
rss 360448
==============
rss 360448
rss 1429504
rss 552960
==============
rss 552960
rss 1359872
rss 1359872
@chenkaie
chenkaie / uvc-rtmp-service-watchdog.expect
Created August 30, 2016 14:50
UVC RTMP Service Watchdog
#!/usr/bin/env expect
# Description:
# This tool aims to achieve the "auto-start script" upon device reboot or power lost,
# since there's no ready auto-start hook at post-init stage for UVC
# Installation:
# Install "expect", "netcat" and "sshpass" first if your Linux distribution don't have it ready
# $ sudo apt-get install expect sshpass netcat
@chenkaie
chenkaie / uvc-watchdog.expect
Last active September 19, 2018 03:30
UVC Watchdog
#!/usr/bin/env expect
# Description:
# This tool aims to achieve the "auto-start script" upon device reboot or power lost,
# since there's no ready auto-start hook at post-init stage for UVC
# Installation:
# Install "expect", "netcat" and "sshpass" first if your Linux distribution don't have it ready
# $ sudo apt-get install expect sshpass netcat
@chenkaie
chenkaie / rtmp_player.html
Last active August 5, 2016 01:57
UVC RTMP Player
<head>
<!--
Enable RTMP feature by
Step 1. ssh into camera
Step 2. paste below command into terminal
echo createService ip=0.0.0.0 port=1935 protocol=inboundRtmp | nc 127.0.0.1 1112 -w 1 -i 1
Then replace it with corresponding IP address of your UVC
<source src="rtmp://192.168.1.20:1935/live/s0" type='rtmp/mp4'>
-->
@chenkaie
chenkaie / ffserver.conf
Created July 8, 2016 10:26
How to transcoding RTSP H264 to HTTP MJPEG by FFMPEG/FFSERVER along with UBNT UVC
HTTPPort 8888
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000000
CustomLog -
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 20M
@chenkaie
chenkaie / 5bupeSphqwy.js
Last active July 6, 2016 02:28
FB video upload parser
if (self.CavalryLogger) {
CavalryLogger.start_js(["xTY7O"]);
}
__d('FileHasher', ['WebWorker', 'fileSliceName', 'emptyFunction', 'FileHashWorkerResource'], function a(b, c, d, e, f, g) {
if (c.__markCompiled) c.__markCompiled();
h.isSupported = function() {
'use strict';
return c('WebWorker').isSupported();
};
/*
* $ gcc countbit.c -o countbit.out
* $ ./countbit.out
* ===============================================================
* <PROFILING> Start : [ProfilingStart] (1414405319.256769)
* <PROFILING> End : [ProfilingEnd] (1414405339.508215) g_uiDiff = 20251,446
* ===============================================================
* ===============================================================
* <PROFILING> Start : [ProfilingStart] (1414405339.508239)
* <PROFILING> End : [ProfilingEnd] (1414405355.221734) g_uiDiff = 15713,495
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
struct timeval g_tvStart, g_tvEnd;
unsigned int g_uiDiff;
void ProfilingStart()
{
g_uiDiff = 0;
@chenkaie
chenkaie / download_wretch_album.sh
Last active December 22, 2015 13:59
Description: 無名小站相片打包程式 (download_wretch_album.sh) Ref: http://www.wretch.cc/blog/WretchFAQ/13637278
#!/bin/bash
# Modify below 2 variables if needed
ALBUM_NUM=50
ALBUM_FOLDER="./SambaGhost-data/album/"
cd ${ALBUM_FOLDER}
for (( i = 1; i <= ${ALBUM_NUM}; i++ )); do
echo "==> Create folder ${i}"
@chenkaie
chenkaie / gist:2622512
Created May 6, 2012 14:23
commentPhotoDo
<script type='text/javascript'>
//<![CDATA[
var times= 0;
function commentPhotoDo() {
var tag;
for(var i = 0; i < commentPhotoIds.length; i++){
tag = document.createElement('script');
tag.type = 'text/javascript';
tag.src = 'http://chenkaie.110mb.com/avatar.php?maxheight=60&url='+encodeURIComponent(commentPhotoIds[i].url)+'&id='+encodeURIComponent(commentPhotoIds[i].id)+'&defaultimage='+encodeURIComponent('http://bloggerhacks.googlecode.com/files/No_Photo.PNG');
//tag.src = 'http://bloggerhacks.googlecode.com/files/No_Photo.PNG)';