Skip to content

Instantly share code, notes, and snippets.

@royshil
royshil / opencv_capture_v4l2.py
Created March 4, 2016 18:59
A way to set V4L2 camera params for OpenCV, when cv2.VideoCapture doesn't work. This requires the python-v42lcapture module (https://github.com/gebart/python-v4l2capture)
#!/usr/bin/env python
import numpy as np
import cv2
import os
import v4l2capture
import select
if __name__ == '__main__':
#cap = cv2.VideoCapture(0)
@rjeczalik
rjeczalik / building-static-nginx.txt
Created October 19, 2013 15:37
Notes on building nginx as a static binary.
# Building static nginx for teh lulz
#
# basic dependencies
sudo apt-get install libxslt1-dev libxml2-dev zlib1g-dev libpcre3-dev libbz2-dev libssl-dev
# download nginx and openssl
wget http://nginx.org/download/nginx-1.5.6.tar.gz
tar xf nginx-1.5.6.tar.gz; cd nginx-1.5.6
@jaypei
jaypei / use_c_sleep.go
Last active July 17, 2023 06:26
Golang的调度机制决定Sleep是用户态实现的。但实现存在一个问题,若go程序在Sleep的过程中系统时间发生变化,Sleep会不准确,因为runtime中的实现是通过时间列表判断每个goroutine的挂起时间,而这个时间就是用的系统时间。这段代码是用cgo调用C的sleep规避这个问题的实现。
package main
/*
#include <unistd.h>
*/
import "C"
import (
"fmt"
"time"
)
@splhack
splhack / Makefile
Created May 6, 2011 02:17
Makefile for adb
SRCS+= adb.c
SRCS+= adb_client.c
SRCS+= commandline.c
SRCS+= console.c
SRCS+= file_sync_client.c
SRCS+= fdevent.c
SRCS+= get_my_path_linux.c
SRCS+= services.c
SRCS+= sockets.c
SRCS+= transport.c