Skip to content

Instantly share code, notes, and snippets.

@BlindLemonLipschitz
BlindLemonLipschitz / macro.rb
Last active June 7, 2017 13:47
Convert a string to macro syntax for TMK keyboard firmware(https://github.com/tmk/tmk_keyboard)
#!/bin/env ruby
# convert a string into macro syntax for TMK firmware
# be sure to escape quotes e.g. ruby macro.rb "Pass\"word1"
# usage: ruby macro.rb "STRING" NAME_OF_MACRO
# Example:
# prompt# ruby macro.rb "this\"is aPa33word" name
# "T(T), T(H), T(I), T(S), D(LSFT), T(QUOT), U(LSFT), T(I), T(S), D(LSFT),/
# T(SPC), U(LSFT), T(A), D(LSFT), T(P), U(LSFT), T(A), T(3), T(3), T(W),/
# T(O), T(R), T(D), "
#