Skip to content

Instantly share code, notes, and snippets.

@TheNotary
TheNotary / stuxnet_for_keyboards.md
Created September 13, 2024 21:58
I Accidentally Discovered the Stuxnet of Keyboards while Writing a Userspace HID Driver

I Accidentally Discovered the Stuxnet of Keyboards while Writing a Userspace HID Driver

Before we get into the secret codes I stumbled upon that are seemingly capable of mass destruction against a boutique mechanical keyboard company's product line... I want to explain my background and how I even wound up reverse engineering a keyboard and writing my own driver for it in C++. Most of the time, my professional work is done at a much higher level while engaged working on digital products. But lately I've been excited to be working on a Go server to handle the backend traffic for an upcoming multiplayer scavenger/ action title. Researching the real-time networking stuff has entailed reading and watching a lot of networking content authored by C++ gurus, with slides of C++ code cropping up left and right that only serve to raise more questions about C++ syntax than they answered about handling latency. Tired of the uncertainty, I finally decided to deep

@TheNotary
TheNotary / main.tf
Created October 11, 2023 19:36
example of maintaining a persistent storage volume and with an ephemeral VM
provider "aws" {
region = "us-west-1"
# profile = "${var.aws_profile}"
}
# aws ec2 describe-instances --query "Reservations[*].Instances[*].[InstanceId,State.Name,PrivateIpAddress,PublicIpAddress,InstanceType,Tags]" --output table
resource "aws_instance" "generic" {
ami = "ami-0beb0c1a33f8fddf2" # us-west-1
instance_type = "t2.micro"
key_name = "${aws_key_pair.generic.id}"
@TheNotary
TheNotary / backend-heavy.mermaid
Last active February 27, 2023 19:51
Websocket connection and reconnection
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@TheNotary
TheNotary / KeyboardLayout.json
Last active May 30, 2022 16:55
KeyboardLayout IDE
[{a:3}, "All Tests", "Step Over", ">.<"],
[{a:3}, "Repeat Test", "Step Into", "->"],
[{x:0.8,a:6, y: 0.3},"//",{w:1,x:0.6, w:1 },"Esc",{x:1},"F1","F2","F3","F4",{x:0.5},"F5","F6","F7","F8",{x:0.5},"F9","F10","F11","F12",{a:5},"Del\nInsert"],
[{x:0.3,a:4, y: 0.1},"Cmd 1",{w:1},";",{x:0.1, w:1 },"~\n`","!\n1","@\n2","#\n3","$\n4","%\n5","^\n6","&\n7","*\n8","(\n9",")\n0","_\n-","+\n=",{a:6,w:2},"Backspace","Page Up"],
[{x:0.3,a:4},"Cmd 2","Alt Enter",{x:0.1, w:1.5 },"Tab","Q","W","E","R","T","Y","U","I","O","P","{\n[","}\n]",{w:1.5},"|\n\\",{a:5},"Home\nPause"],
[{x:0.3,a:3},"💾",{a:4},"Del",{x:0.1,w:1.75 },"Home","A","S","D","F","G","H","J","K","L",":\n;","\"\n'",{a:3,w:1.75},"Enter",{a:5, w:1.5},"End\nPrtSc"],
[{x:2.4,w:2.25,a:4},"Shift","Z","X","C","V","B","N","M","<\n,",">\n.","?\n/",{a:6,w:1.75},"Shift",{a:7},"↑",{a:5},"Page Down"],
[{x:2.4,w:1.25 },"Ctrl",{w:1.25},"Win",{w:1.25},"Alt",{a:7,w:6.25},"",{a:6},"Alt","Fn","Ctrl",{a:7},"←","↓","→"]
@TheNotary
TheNotary / file.rb
Created November 8, 2021 22:53
What's the best way to add putsd as an alternative to puts to an app?
module App
module Debugable
def putsd(msg)
puts msg if ENV[DEBUG]
end
def self.putsd(msg)
puts msg if ENV[DEBUG]
end
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: "allow-nodeport-my-shell"
spec:
podSelector:
matchLabels:
run: "my-shell"
{
"title": "Hello World",
"tagline": "A hello world app",
"description": "Your example for installing web apps into kano as 'apps'.",
"slug": "hello",
"icon": "secrets",
"colour": "#f8584b",
"categories": ["media"],
@TheNotary
TheNotary / install_plugins.init.groovy
Created April 11, 2019 12:39
Someone posted this to a forum... as an attachment...
import jenkins.model.*
import java.util.logging.Logger
def logger = Logger.getLogger("02_installPlugins.groovy")
def installed = false
def initialized = false
def fileSeperator=File.separator;
println("Plugins Count Before Installation: "+Jenkins.instance.pluginManager.plugins.size())
def filepath="/home/lvadmin/.jenkins/init.groovy.d"+fileSeperator+"pluginslist.cfg";
println "pluginslist.cfg FilePath : $filepath"
def pluginslist = []
@TheNotary
TheNotary / setup-users.groovy
Created April 10, 2019 14:31 — forked from wiz4host/setup-users.groovy
jenkins init.groovy.d script for configuring users
import jenkins.*
import hudson.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import hudson.plugins.sshslaves.*;
import hudson.model.*
import jenkins.model.*
import hudson.security.*
require 'json'
require 'yaml'
# Make sure the vagrant-ignition plugin is installed
required_plugins = %w(vagrant-ignition) # vagrant-persistent-storage
plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin }
if not plugins_to_install.empty?