Skip to content

Instantly share code, notes, and snippets.

View chenminhua's full-sized avatar
🎯
Focusing

陈敏华 chenminhua

🎯
Focusing
View GitHub Profile
@chenminhua
chenminhua / epoll.go
Created February 24, 2022 12:58 — forked from tevino/epoll.go
An example of using epoll in Go
package main
import (
"fmt"
"net"
"os"
"syscall"
)
const (
@chenminhua
chenminhua / Makefile
Created February 14, 2022 04:26 — forked from sighingnow/Makefile
Detect operating system in Makefile.
# Detect operating system in Makefile.
# Author: He Tao
# Date: 2015-05-30
OSFLAG :=
ifeq ($(OS),Windows_NT)
OSFLAG += -D WIN32
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
OSFLAG += -D AMD64
endif
public class LRUCache {
class DLinkedNode {
int key;
int value;
DLinkedNode prev;
DLinkedNode next;
}
private DLinkedNode head, tail;
int a[maxn];
int lowbit(int x)
{
return x&(-x);
}
void add(int x,int y)
{
while(x<=n)
{
a[x]+=y;
int find(int x)
{
if(x!=fa[x])
fa[x]=find(fa[x]);
return fa[x];
}
void union(int x,int y)
{
int a=find(x),b=find(y);
if(a!=b)
@chenminhua
chenminhua / open_camera_or_video.py
Created July 25, 2019 06:27
opencv camera snippet
import cv2
# cam = cv2.VideoCapture(0) # local camera
# cam = cv2.VideoCapture("/path/to/video") # open video
cam = cv2.VideoCapture("rtsp://admin:password123@192.168.1.64:554")
# 设置摄像头尺寸
cam.set(cv2.CAP_PROP_FRAME_WIDTH, 64)
cam.set(cv2.CAP_PROP_FRAME_HEIGHT, 48)
# 获取摄像头尺寸
while True:
ret, frame = cam.read()
public class Foo {
// immutability
private final int a;
private final int b;
private final int c;
private final int d;
private final int e;
public static class Builder {
private final int a;