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
@chetbox
chetbox / launch-qemu-rpi-3.sh
Last active July 4, 2024 13:47
Run Raspberry Pi 64 system image with QEMU on macOS
#!/bin/bash
# Requirements:
# - macOS
# - qemu - `brew install qemu`
# - A raw 64-bit Raspberry Pi system image to boot (Usually a .img)
set -e
if [[ -z "$1" ]]; then
@cGandom
cGandom / RaspberryPi4-qemu.md
Last active July 18, 2024 16:00
Emulating Raspberry Pi 4 with Qemu

Emulating Raspberry Pi 4 with Qemu

Just a quick update before we dive in: what we're actually doing here is running Raspberry Pi OS (64-bit) on a QEMU virtual ARM setup. This isn't full-blown hardware emulation of the Raspberry Pi 4, but more about creating a virtual environment for the OS. It doesn't mimic all the specific hardware features of the Pi 4, but it's pretty useful and great for general testing. I turned to this solution mainly to extract a modified sysroot from the Raspberry Pi OS, something not readily available in other resources. For those looking into detailed emulation of the actual Raspberry Pi 4's hardware in QEMU, check out this link for the latest updates: https://gitlab.com/qemu-project/qemu/-/issues/1208.

Hope it helps! :D

Shortcomings: No GUI yet, only console.

Steps

@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)
@BrendonKoz
BrendonKoz / leaflet-darkmode.md
Last active June 4, 2024 03:20
Automatic Dark Mode for Leaflet.js
// Leaflet JS - note the *className* attribute
// [...]

L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
    className: 'map-tiles'
}).addTo(map);

// [...]
@FreddieOliveira
FreddieOliveira / docker.md
Last active July 22, 2024 16:49
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/