Skip to content

Instantly share code, notes, and snippets.

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
@Thimira
Thimira / ObjectTracker.py
Last active November 11, 2021 06:07
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 = []
@Pulimet
Pulimet / AdbCommands
Last active July 17, 2024 12:55
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
@laoar
laoar / mmap_zcopy
Last active June 3, 2024 09:07
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"
@pottedmeat7
pottedmeat7 / PollUSBActivity.java
Last active May 20, 2018 11:05
Android Activity to read from USB
//connects and reads from usb device
public class PollUSBActivity extends Activity implements View.OnClickListener {
private static final String TAG = "USBReader";
private TextView mLog;
private UsbManager mUsbManager;
private UsbDevice mDevice;
@tailriver
tailriver / dlopen_sample.c
Created November 18, 2015 04:21
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*);
@Jxck
Jxck / README.md
Created December 16, 2012 09:16
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