Skip to content

Instantly share code, notes, and snippets.

View dougmarcey's full-sized avatar

Doug Marcey dougmarcey

  • Northern VA, USA
  • 06:24 (UTC -05:00)
View GitHub Profile
View cleanup.rb
#!/usr/bin/ruby
# Tool to convert Ergodox-EZ Configurator generated keymaps
# to something a little easier to read/work with.
#
# runs like:
# cleanup.rb [downloaded keymap.c] > [destination keymap.c]
def fix_keymap(km_str)
View cleanup.pl
#!/usr/bin/perl
# Tool to convert Ergodox-EZ Configurator generated keymaps
# to something a little easier to read/work with.
#
# runs like:
# cleanup.rb [downloaded keymap.c] > [destination keymap.c]
open(FILE,$ARGV[0]) || die "Can't open the file [$!]\n";
local $/;
View cleanup.pl
#!/usr/bin/perl
# Tool to convert Ergodox-EZ Configurator generated keymaps
# to somthing a little easier to read/work with.
#
# runs like:
# cleanup.rb [downloaded keymap.c] > [destination keymap.c]
open(FILE,$ARGV[0]) || die "Can't open the file [$!]\n";
local $/;
View cleanup.rb
#!/usr/bin/ruby
# Tool to convert Ergodox-EZ Configurator generated keymaps
# to somthing a little easier to read/work with.
#
# runs like:
# cleanup.rb [downloaded keymap.c] > [destination keymap.c]
def fix_keymap(km_str)
View cleanup.rb
#!/usr/bin/ruby
def fix_keymap(km_str)
km_str.gsub!(/LALT\(LCTL\(LGUI\(LSFT\((.*?)\)\)\)\)/,'HYPR(\1)')
km_str.gsub!(/LGUI\(LSFT\((.*?)\)\)/,'SGUI(\1)')
km_str.gsub!(/LALT\(LCTL\((.*?)\)\)/,'LCA(\1)')
km_str.gsub!(/LCTL\(LGUI\(LSFT\((.*?)\)\)\)/,'LCGS(\1)')
km_str.gsub!(/LCTL\(LSFT\((.*?)\)\)/,'LCS(\1)')
km_str.gsub!(/MT\(MOD_HYPR, (.*?)\)/,'HYPR_T(\1)')
km_str.gsub!(/MT\(MOD_MEH, (.*?)\)/,'MEH_T(\1)')
View cleanup.pl
#!/usr/bin/perl
# Tool to convert Ergodox-EZ Configurator generated keymaps
# to somthing a little easier to read/work with.
#
# runs like:
# cleanup.rb [downloaded keymap.c] > [destination keymap.c]
open(FILE,$ARGV[0]) || die "Can't open the file [$!]\n";
local $/;
View cleanup.rb
#!/usr/bin/ruby
def fix_keymap(km_str)
km_str.gsub!(/LALT\(LCTL\(LGUI\(LSFT\((.*?)\)\)\)\)/,'HYPR(\1)')
km_str.gsub!(/LGUI\(LSFT\((.*?)\)\)/,'SGUI(\1)')
km_str.gsub!(/LALT\(LCTL\((.*?)\)\)/,'LCA(\1)')
km_str.gsub!(/LCTL\(LGUI\(LSFT\((.*?)\)\)\)/,'LCGS(\1)')
km_str.gsub!(/LCTL\(LSFT\((.*?)\)\)/,'LCS(\1)')
km_str.gsub!(/MT\(MOD_HYPR, (.*?)\)/,'HYPR_T(\1)')
km_str.gsub!(/MT\(MOD_MEH, (.*?)\)/,'MEH_T(\1)')
View cleanup.pl
#!/usr/bin/perl
open(FILE,$ARGV[0]) || die "Can't open the file [$!]\n";
local $/;
$keymap = <FILE>;
close(FILE);
$keymap =~ s/LALT\(LCTL\(LGUI\(LSFT\((.*?)\)\)\)\)/HYPR($1)/g;
$keymap =~ s/LGUI\(LSFT\((.*?)\)\)/SGUI($1)/g;
$keymap =~ s/LALT\(LCTL\((.*?)\)\)/LCA($1)/g;
$keymap =~ s/LCTL\(LGUI\(LSFT\((.*?)\)\)\)/LCGS($1)/g;
$keymap =~ s/LCTL\(LSFT\((.*?)\)\)/LCS($1)/g;
View cleanup.pl
#!/usr/bin/perl
open(FILE,$ARGV[0]) || die "Can't open the file [$!]\n";
local $/;
$keymap = <FILE>;
close(FILE);
$keymap =~ s/LALT\(LCTL\(LGUI\(LSFT\((.*?)\)\)\)\)/HYPR($1)/g;
$keymap =~ s/LGUI\(LSFT\((.*?)\)\)/SGUI($1)/g;
$keymap =~ s/LALT\(LCTL\((.*?)\)\)/LCA($1)/g;
$keymap =~ s/LCTL\(LGUI\(LSFT\((.*?)\)\)\)/LCGS($1)/g;
$keymap =~ s/LCTL\(LSFT\((.*?)\)\)/LCS($1)/g;
View cleanup.rb
#!/usr/bin/ruby
def fix_keymap(km_str)
km_str.gsub!(/LALT\(LCTL\(LGUI\(LSFT\((.*?)\)\)\)\)/,'HYPR(\1)')
km_str.gsub!(/LGUI\(LSFT\((.*?)\)\)/,'SGUI(\1)')
km_str.gsub!(/LALT\(LCTL\((.*?)\)\)/,'LCA(\1)')
km_str.gsub!(/LCTL\(LGUI\(LSFT\((.*?)\)\)\)/,'LCGS(\1)')
km_str.gsub!(/LCTL\(LSFT\((.*?)\)\)/,'LCS(\1)')
km_str.gsub!(/MT\(MOD_HYPR, (.*?)\)/,'HYPR_T(\1)')
km_str.gsub!(/MT\(MOD_MEH, (.*?)\)/,'MEH_T(\1)')