Skip to content

Instantly share code, notes, and snippets.

View willwade's full-sized avatar
🌏
Working on dasher and a lot of Ace hardware projects

will wade willwade

🌏
Working on dasher and a lot of Ace hardware projects
View GitHub Profile
@willwade
willwade / ppm-autocorrection.swift
Last active October 26, 2023 10:59
PPM in swift courtesy of GPT. Here The generateCandidates(word:) method generates candidate words by swapping adjacent characters. This is a very simplistic way to generate candidates; in a real-world application, you might use more sophisticated techniques like Damerau-Levenshtein distance. The autocorrect(word:context:topN:) method takes a mis…
/** So really you'd want to update that training text continually too - but you ideally need a way for people correcting this training text. Something that was easy enough with dasher although undcoumented. You literally edit the text file.
Also note this for autocorrection - but not sure how we would implement this
**/
extension PPM {
// Generate candidate words by swapping adjacent characters
func generateCandidates(word: String) -> [String] {
var candidates: [String] = []
var chars = Array(word)
for i in 0..<(chars.count - 1) {
@willwade
willwade / remap.py
Last active September 18, 2023 10:50
this takes the directory of xkb keyboard maps found in linux at /usr/share/X11/xkb/symbols - and converts them to a relaykeys format e.g. https://github.com/AceCentre/RelayKeys/blob/master/cli_keymaps/de_keymap.json
import os
import re
import json
import unicodedata
def xkb_to_unicode(key_code):
# Add your custom mapping here
custom_mapping = {
"adiaeresis": "ä",
"odiaeresis": "ö",
@willwade
willwade / requirements.txt
Last active July 5, 2023 15:47
MIgrating to https://github.com/AceCentre/TranslateAndTTS Copy pasteboard, translate the pasteboard to a predefined language, then speak it. Note settings in cfg file - Will allow you to replace pasteboard if you wish. NB: pyenv 3.10 - pip install -r requirements.txt build using pyinstaller. use --onefile --noconsole
pyperclip
pyttsx4
configparser
translate
TTS
pyaudio
gTTS
gspeak
pygame
from pynput.mouse import Controller
from pynput.keyboard import Listener, Key
import time
# Create an instance of the mouse controller
mouse = Controller()
# Set the initial position of the cursor
x, y = mouse.position
@willwade
willwade / DetectSounds.py
Last active March 29, 2023 15:35
Detect sounds to Keypress
import sounddevice as sd
import numpy as np
import librosa
import pynput.keyboard as keyboard
# Set the minimum and maximum frequencies for the "ahh" sound
min_freq = 500
max_freq = 2000
# Set the minimum and maximum frequencies for the "ssss" sound
@willwade
willwade / aeroswitch-log-win.txt
Created January 30, 2023 13:25
log from windows
Full press and release:
start scanning for: AeroSwitch
1675084981.252 | MAC: 84:71:27:89:2B:61 | Adv: AdvertisementData(local_name='AeroSwitch', manufacturer_data={6026: b'\x15\x01\x00d\xcf\x00\x00@\x00\x00\x00'}, rssi=-75)
1675084981.264 | MAC: 84:71:27:89:2B:61 | Adv: AdvertisementData(local_name='AeroSwitch', manufacturer_data={6026: b'\x15\x01\x00d\xcf\x00\x00J\x00\x00\x00'}, rssi=-75)
1675084981.524 | MAC: 84:71:27:89:2B:61 | Adv: AdvertisementData(local_name='AeroSwitch', manufacturer_data={6026: b'\x15\x00\x01d\xd0\x00\x00\x15\x015\x00'}, rssi=-71)
1675084981.531 | MAC: 84:71:27:89:2B:61 | Adv: AdvertisementData(local_name='AeroSwitch', manufacturer_data={6026: b'\x15\x00\x01d\xd0\x00\x00\x15\x01@\x00'}, rssi=-71)
@willwade
willwade / log.txt
Created January 30, 2023 13:06
log
Down:
1675083830.681 | MAC: 1A96C75A-5F25-34F9-EB06-0583B08021C1 | Adv: AdvertisementData(local_name='AeroSwitch', manufacturer_data={6026: b'\x15\x01\x00d\xab\x00\x005\x00\x00\x00'}, rssi=-49)
1675083830.694 | MAC: 1A96C75A-5F25-34F9-EB06-0583B08021C1 | Adv: AdvertisementData(local_name='AeroSwitch', manufacturer_data={6026: b'\x15\x01\x00d\xab\x00\x00@\x00\x00\x00'}, rssi=-49)
1675083830.704 | MAC: 1A96C75A-5F25-34F9-EB06-0583B08021C1 | Adv: AdvertisementData(local_name='AeroSwitch', manufacturer_data={6026: b'\x15\x01\x00d\xab\x00\x00J\x00\x00\x00'}, rssi=-49)
1675083830.714 | MAC: 1A96C75A-5F25-34F9-EB06-0583B08021C1 | Adv: AdvertisementData(local_name='AeroSwitch', manufacturer_data={6026: b'\x15\x01\x00d\xab\x00\x00U\x00\x00\x00'}, rssi=-48)
@willwade
willwade / log.txt
Last active January 30, 2023 12:26
ble output
Full Press and release:
MAC: 1A96C75A-5F25-34F9-EB06-0583B08021C1 | Adv: AdvertisementData(local_name='AeroSwitch', manufacturer_data={6026: b'\x15\x01\x00d\xa3\x00\x00\x00\x00\x00\x00'}, rssi=-45)
MAC: 1A96C75A-5F25-34F9-EB06-0583B08021C1 | Adv: AdvertisementData(local_name='AeroSwitch', manufacturer_data={6026: b'\x15\x01\x00d\xa3\x00\x00\x0b\x00\x00\x00'}, rssi=-45)
MAC: 1A96C75A-5F25-34F9-EB06-0583B08021C1 | Adv: AdvertisementData(local_name='AeroSwitch', manufacturer_data={6026: b'\x15\x01\x00d\xa3\x00\x00\x16\x00\x00\x00'}, rssi=-45)
MAC: 1A96C75A-5F25-34F9-EB06-0583B08021C1 | Adv: AdvertisementData(local_name='AeroSwitch', manufacturer_data={6026: b'\x15\x01\x00d\xa3\x00\x00 \x00\x00\x00'}, rssi=-45)
@willwade
willwade / logMessageChanges.py
Created October 10, 2022 11:26
Logs changes to a AAC software - to log when someone is using it or not
'''
Originally from [email protected] for his https://github.com/mattoppenheim/microbit_activity_indicator
Hacked by Will - just logs if someone is writing or not. Used as a tool to detect how long someone is using their Aid for
Of course doesn't log if its person or someone helping
'''
from logging.handlers import RotatingFileHandler
import click
from datetime import datetime
import logging
@willwade
willwade / ar-Adult-Starter.md
Created September 21, 2022 15:53
Adult Starter Arabic

كلمات سريعة مساعدة قف الاختناق. تحتاج شفط. أكثر أقل دردشة كيف حالك؟ ماذا كنتم تفعلون؟ شكرا لك