Skip to content

Instantly share code, notes, and snippets.

View yezhiming's full-sized avatar

Justin Yip yezhiming

  • gitee.com
  • GuangZhou China
View GitHub Profile
@yezhiming
yezhiming / avframe_to_cvmat.cpp
Last active January 28, 2019 15:05
convert FFmpeg AVFrame to OpenCV Mat
#include <opencv2/opencv.hpp>
extern "C"
{
#include <libswscale/swscale.h>
#include <libavutil/imgutils.h>
#include <libavutil/frame.h>
}
// link libswscale in c++
// ref: https://soledadpenades.com/posts/2009/linking-with-ffmpegs-libav/
@yezhiming
yezhiming / timeoutPromise.js
Created September 26, 2016 10:28
timeout promise use with window.fetch
// ref: https://github.com/github/fetch/issues/175
function timeoutPromise(ms, promise) {
return new Promise( (resolve, reject) => {
const timeoutId = setTimeout( () => {
reject( new Error("timeout") )
});
promise.then(
(res) => {
clearTimeout(timeoutId);
@yezhiming
yezhiming / pptpd.sh
Created April 11, 2015 15:00
Automaticlly install pptpd on Amazon EC2 Amazon Linux
# Automaticlly install pptpd on Amazon EC2 Amazon Linux
#
# Ripped from http://blog.diahosting.com/linux-tutorial/pptpd/
# pptpd source rpm packing by it's authors
#
# WARNING:
# first ms-dns setting to 172.16.0.23, 172.16.0.23 was showing on my
# /etc/resolv.conf, I'm not sure this is the same on all Amazon AWS zones.
#
# You need to adjust your "Security Groups" which you are using too.