Skip to content

Instantly share code, notes, and snippets.

@ct3huang
ct3huang / README.md
Created April 26, 2019 09:09 — forked from Jxck/README.md
libuv TCP server/client sample

how to compile

$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices server.c -o server
$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices client.c -o client
@ct3huang
ct3huang / ObjectTracker.py
Created February 21, 2020 07:56 — forked from Thimira/ObjectTracker.py
Track any object in a video with Dlib Correlation Trackers. Tutorial: https://www.codesofinterest.com/2018/02/track-any-object-in-video-with-dlib.html
'''
Using Correlation Trackers in Dlib, you can track any object in a video stream without needing to train a custom object detector.
Check out the tutorial at: http://www.codesofinterest.com/2018/02/track-any-object-in-video-with-dlib.html
'''
import numpy as np
import cv2
import dlib
# this variable will hold the coordinates of the mouse click events.
mousePoints = []
@ct3huang
ct3huang / mmap_zcopy
Created March 12, 2020 05:54 — forked from laoar/mmap_zcopy
an example of kernel space to user space zero-copy via mmap, and also the comparing mmap with read/write
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <asm/uaccess.h>
#define MAX_SIZE (PAGE_SIZE * 2) /* max size mmaped to userspace */
#define DEVICE_NAME "mchar"
@ct3huang
ct3huang / dlopen_sample.c
Created April 16, 2020 08:06 — forked from tailriver/ dlopen_sample.c
A sample of using dlopen library.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
int main(int argc, char** argv)
{
void *handle;
void (*func_print_name)(const char*);
@ct3huang
ct3huang / AdbCommands
Created October 15, 2021 02:33 — forked from Pulimet/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
widthheight=$(wm size | sed "s/.* //")
width=$(($(echo $widthheight | sed "s/x.*//g" )+0))
height=$(($(echo $widthheight | sed "s/.*x//g" )+0))
GetColorAtPixel () {
x=$1;y=$2;
rm ./screen.dump 2> /dev/null
screencap screen.dump
screenshot_size=$(($(wc -c < ./screen.dump)+0));
buffer_size=$(($screenshot_size/($width*height)))
let offset=$width*$y+$x+3