Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
xdotool mousemove 100 100
xdotool click 1
for i in `rand -M 3 -N 1000`; do
echo -n "Play $i "
case "$i" in
"0")
@enricofoltran
enricofoltran / main.go
Last active July 25, 2024 03:38
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@amitn
amitn / send_event.c
Created March 20, 2014 15:39
look ma no hands (and cables)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/input.h>
#include <errno.h>
#include <time.h>
@amitn
amitn / Android.mk
Created March 20, 2014 06:25
Android screen shot using OpenCV
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# OpenCV
OPENCV_CAMERA_MODULES := off
OPENCV_INSTALL_MODULES := off
OPENCV_LIB_TYPE := STATIC
@amitn
amitn / Yoga 2 Pro - Sensors
Created February 4, 2014 07:17
Yoga 2 Pro - Sensors
Hardware Perspective
--------------------
* It is look like that Lenovo has aggregated bunch of sensors into one USB HID Device, this will be `2047:0855 Texas Instruments`.
* This device has a big HID descriptor which report each sensor using `Usage Page 05 20 - Sensor Page (0x20)`
* There are 8 reports in the descriptor, for each report there is a bit map of the sensor properties:
```
Usage 0A 09 03 - Property: Sensor Connection Type
Usage 0A 16 03 - Property: Reporting State
Usage 0A 19 03 - Property: Power State
@tylerneylon
tylerneylon / learn.lua
Last active July 11, 2024 15:28
Learn Lua quickly with this short yet comprehensive and friendly script. It's written as both an introduction and a quick reference. It's also a valid Lua script so you can verify that the code does what it says, and learn more by modifying and running this script in your Lua interpreter.
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a