Skip to content

Instantly share code, notes, and snippets.

View hugs's full-sized avatar
🤖
Making robots

Jason Huggins hugs

🤖
Making robots
View GitHub Profile
@cbmeeks
cbmeeks / usb_hid_keys.h
Created January 6, 2023 02:19 — forked from ekaitz-zarraga/usb_hid_keys.h
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
@NullCode1337
NullCode1337 / nim_install.md
Last active April 3, 2024 04:27
How to install the Nim Compiler on your Windows PC

Installing Nim on Windows

What is Nim?

Nim is a (pretty obscure) "statically typed compiled systems programming language". It's unique because the syntax is very reminiscent of Python, while being a compiled language (; anyone?), hence making it accessible to Python devs. Now let's cut to the chase - how to install this:

Installing Nim

Method 1: The boring:tm:

(Powershell only)

  1. Install chocolatey
  2. choco install nim
@bitboy85
bitboy85 / boot.py
Last active September 23, 2023 16:16
Circuit python 7 absolute mouse example
import usb_hid
# https://stackoverflow.com/questions/36750287/two-byte-report-count-for-hid-report-descriptor
absolute_mouse = usb_hid.Device(
report_descriptor=bytes(
# Absolute mouse
(0x05, 0x01) # Usage Page (Generic Desktop)
+ (0x09, 0x02) # Usage (Mouse)
+ (0xA1, 0x01) # Collection (Application)
+ (0x09, 0x01) # Usage (Pointer)
@FreddieOliveira
FreddieOliveira / docker.md
Last active April 16, 2024 04:52
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@erictroebs
erictroebs / Touch.cpp
Last active November 10, 2023 17:14
Arduino Micro (ATmega32U4) Ten Finger Touchscreen Example
#include "Touch.h"
#if defined(_USING_HID)
#define CONTACT_COUNT_MAXIMUM 10
#define REPORTID_TOUCH 0x04
#define LSB(v) ((v >> 8) & 0xff)
#define MSB(v) (v & 0xff)
# nim c -r --threads:on --gc:orc
import cpuinfo, os, random, locks, deques
type
WorkReq = ref object
id: int
WorkRes = ref object
id: int
@jake-b
jake-b / usb_hid_gadget.sh
Created May 7, 2020 14:12
Emulate both a keyboard and mouse using the USB
#!/bin/bash
# References:
# https://www.isticktoit.net/?p=1383
# http://irq5.io/2016/12/22/raspberry-pi-zero-as-multiple-usb-gadgets/
# After running this, use hid_gadget_test.c <https://github.com/aagallag/hid_gadget_test/blob/master/hid_gadget_test.c>
cd /sys/kernel/config/usb_gadget/
@brutella
brutella / rpi-enable-camera-module.md
Last active February 9, 2024 09:48
How to enable the camera module on a Raspberry Pi

Enable camera module

Edit your /boot/config.txt file and make sure the following lines look like this:

start_x=1             # essential
gpu_mem=128           # at least, or maybe more if you wish
disable_camera_led=1  # optional, if you don't want the led to glow

Load bcm2835-v4l2 module

@james4388
james4388 / mjpeg_stream_multipart_writer.py
Last active December 26, 2023 04:19
MJPEG stream using aiohttp, opencv, multipartwriter
import asyncio
import cv2
from aiohttp import web, MultipartWriter
async def mjpeg_handler(request):
boundary = "boundarydonotcross"
response = web.StreamResponse(status=200, reason='OK', headers={
'Content-Type': 'multipart/x-mixed-replace; '
'boundary=--%s' % boundary,
@anjuan
anjuan / sideload_android_ota_update_using_adb.md
Last active April 11, 2024 10:37
Sideload Android OTA Update Using ADB

Pre-Work

  1. Make sure you backup any personal data such as photos before applying update.
  2. Get the latest adb tool from the Android SDK Platform-Tools package.
  3. Add adb to your PATH environment variable or, as the instructions below assume, change into the directory containing the executable.
  4. Enable USB debugging for your device as described here.

On Machine

  1. Change into the directory containing the adb executable.
  2. Download the latest OTA image (appropriate for your device) from https://developers.google.com/android/ota into the adb directory.