Skip to content

Instantly share code, notes, and snippets.

View hasumikin's full-sized avatar
🐕‍🦺
inu

HASUMI Hitoshi hasumikin

🐕‍🦺
inu
View GitHub Profile
@hasumikin
hasumikin / screen.rb
Created September 29, 2025 23:57
macOSとscreenで消耗している人のためのスクリプト
#!/usr/bin/env ruby
require 'fileutils'
DEFAULT_DEVICE = '/dev/ttyUSB0'
DEFAULT_BAUDRATE = '115200'
if ARGV.include?('--help') || ARGV.include?('-h')
puts <<~HELP
This script connects to a serial device using 'screen' and automatically

Setup, general information and trouble shooting

Important Notes

(Also read Trouble Shoot)

Laptop Security Settings

If your laptop is configured to prohibit writing to USB memory devices, likely due to your company's security policy, it will not function in the workshop😣

@hasumikin
hasumikin / keymap.rb
Created April 19, 2023 23:46
PRK Firmware ADC example
require "adc"
require "mouse"
kbd = Keyboard.new
kbd.init_direct_pins( [8] )
kbd.add_layer :default, %i(BOOTSEL)
kbd.define_mode_key :BOOTSEL, [ Proc.new { kbd.bootsel! }, nil, 300, nil ]
@hasumikin
hasumikin / keymap.rb
Created April 19, 2023 23:45
PRK Firmware SPI example (Keyball44)
require "spi"
require "mouse"
require "consumer_key"
class SPI
def pmw3360dm_write(*values)
GPIO.write_at(21, 0)
write(*values)
Machine.delay_us 20
GPIO.write_at(21, 1)
@hasumikin
hasumikin / keymap.rb
Created April 19, 2023 23:45
PRK Firmware I2C example
#
# Pin assignment:
# switch matrix:
# row: 1, 2, 3, 4
# col: 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
# RGBLED: 0
# I2C0: trackball and RTC
# sda_pin: 20
# scl_pin: 21
# SPI1:
@hasumikin
hasumikin / gist:c14a75aedc05de046cb39778145338b1
Created November 29, 2022 07:06
例のMaximum call stack size exceededのエラーメッセージ
$ #
$ # irb.wasm - IRB on CRuby on WebAssembly
$ #
$ # Source code is available at https://github.com/kateinoigakukun/irb.wasm
$ #
$ # QUICK START
$ # 1. Install gem by `gem "haml"
$ # 2. `require "haml"`
$ # 3. `Term.echo Haml::Template.new { "%h1 Haml code!" }.render`
$ #
@hasumikin
hasumikin / Picoprobe.md
Last active March 27, 2025 23:34
Debug a Pi Pico app with Picoprobe(WSL2)
@hasumikin
hasumikin / keymap.rb
Last active June 12, 2022 02:51
Sample PRK Firmware keymap for Bolt Industries Pico 87
puts "==== Pico87 ===="
kbd = Keyboard.new
kbd.init_pins(
[ 18, 19, 20, 21, 22, 26 ],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 ]
)
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
@hasumikin
hasumikin / keymap.rb
Created May 6, 2022 02:51
Simulating "Grave Escape" feature of QMK
class Keyboard
def grave_escape
index = @keycodes.index(KEYCODE.index(:KC_ESCAPE).chr)
if index
if (@modifier & 0b00010001) > 0 # CTRL
# Do nothing so that "SHIFT+CTRL+ESCAPE" opens Task Manager
elsif (@modifier & 0b00100010) > 0 # SHIFT
@keycodes[index] = KEYCODE.index(:KC_GRAVE).chr
elsif (@modifier & 0b10001000) > 0 # GUI
@keycodes[index] = KEYCODE.index(:KC_GRAVE).chr