Skip to content

Instantly share code, notes, and snippets.

View jkonrath's full-sized avatar

Jonathan Konrath jkonrath

View GitHub Profile
@jkonrath
jkonrath / kinesis-remap.md
Last active February 18, 2023 18:33
Kinesis Advantage 2 remapping

This is so I remember this in a year when I accidentally reset my keyboard again.

  1. Set it to Mac mode: progm + F5.
  2. Remap Home to Ctrl: progm + F12, then Ctrl, then Home.
  3. Remap End to Esc: progm + F12, then Esc, then End.
  4. Toggle off key clicks: progm + F8.
  5. Toggle off action tones: progm + shift + F8.
  6. In Mac System Preferences, don't change modifiers, but set Use F1, F2 etc as standard function keys.

progm + Esc to see result:

# add to your .bash_profile or whatever
alias nothankyouadobe="sudo -H killall ACCFinderSync \"Core Sync\" AdobeCRDaemon \"Adobe Creative\" AdobeIPCBroker node \"Adobe Desktop Service\" \"Adobe Crash Reporter\";sudo -H rm -rf \"/Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist\" \"/Library/LaunchAgents/com.adobe.AdobeCreativeCloud.plist\" \"/Library/LaunchDaemons/com.adobe.*.plist\""
@jkonrath
jkonrath / scrivener-comment-count
Created July 22, 2021 19:16
Count the number of comments in a Scrivener document from the command line
grep -r "Comment ID" my-book-file.scriv/Files/Data | wc -l
@jkonrath
jkonrath / underscores-to-dashes.bat
Created June 3, 2021 23:31
Windows CMD underscores to dashes
@echo off
rem Go through every file in a directory and replace _ with - in each filename.
rem I'm sure I pasted this from somewhere, no idea.
rem I wouldn't have to do this if people stopped using underscores in filenames.
rem It's bad SEO, and it's that much more typing. Just stop it.
Setlocal enabledelayedexpansion
rem You could change these two to replace any string with another.
Set "Pattern=_"
@jkonrath
jkonrath / windows-cmd-faq.md
Last active September 22, 2023 17:59
Windows CMD batch file frequent issues/tips

Writing Windows CMD Batch File Stuff

I hope I never have to write another Windows .BAT file again in my life, but if I don't jot this stuff down, I will forget it, and then I will.

Subroutines

  1. Use :somelabel to define a block of code.
  2. Use call :somelabel to jump to a defined label, run that block of code to the end, then return.
  3. Use goto :label to jump to that label.
  4. Put :eof at the end of your file.
@jkonrath
jkonrath / doxy-return-split.xsl
Last active August 4, 2020 23:06
XSLT - fix broken Doxygen return list
<!-- XSL 1.0. (This isn't a complete file, just an example.)
Doxygen likes to make broken lists that look like this:
<simplesect kind="return"><para>ABC_SUCCESS on success <linebreak/>
ABC_ERROR_INVALID_PARAMETER if the input parameter is NULL <linebreak/>
ABC_ERROR_DEVICE_NOT_FOUND if the device is not present or supported <linebreak/>
ABC_ERROR_CANNOT_ACTIVATE_SERVER if the sensor server cannot be started </para></simplesect>
That's not a list of elements. It's a single element that's polluted with linebreaks.
@jkonrath
jkonrath / make-timestamped-dir.bat
Last active August 4, 2020 22:39
Windows CMD to make a timestamped directory
@echo off
:: Windows CMD - Make a timestamped directory, prefixed with the first argument.
:: i.e. pass in "proj1" and it creates a directory named "proj1-2020-08-02_09-01-00"
:: It shouldn't be this hard, but it is.
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"
set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"
set "outdir=%1-%fullstamp%"