Skip to content

Instantly share code, notes, and snippets.

@jimratliff
jimratliff / modifier_combination_masks_macos.tsv
Last active May 29, 2018 04:25
Masks for all combinations of modifier-key presses (involving Fn, Shift, Option, Command, and Control) in macOS. (See sources/information in first comment.) #dotfiles #character_codes #symbolichotkeys
Modifier Combination Mask
<No modifiers> 0
Shift 131072
Control 262144
Shift+Control ⇧⌃ 393216
Option 524288
Shift+Option ⇧⌥ 655360
Control+Option ⌃⌥ 786432
Shift+Control+Option ⇧⌃⌥ 917504
Command 1048576
@jimratliff
jimratliff / defaults_help_High_Sierra.txt
Last active May 29, 2018 04:13
Help for the defaults command (High Sierra) #dotfiles #bash #defaults_command
$ defaults help
Command line interface to a user's defaults.
Syntax:
'defaults' [-currentHost | -host <hostname>] followed by one of the following:
read shows all defaults
read <domain> shows defaults for given domain
read <domain> <key> shows defaults for given domain, key
@jimratliff
jimratliff / man_defaults_High_Sierra.txt
Last active May 29, 2018 04:13
man page for defaults command in High Sierra #dotfiles #bash #defaults_command
$ man -P cat defaults
DEFAULTS(1) BSD General Commands Manual DEFAULTS(1)
NAME
defaults -- access the Mac OS X user defaults system
SYNOPSIS
defaults [-currentHost | -host hostname] read [domain [key]]
@jimratliff
jimratliff / jdrunicode.sty
Last active May 29, 2018 04:10
jdrunicode package for LaTeX/Overleaf #latex #overleaf
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The jdrunicode package for LaTeX and Overleaf
%
% Author: Jim Ratliff
% [email protected]
% May 4, 2018
%
% Defines two commands:
%
@jimratliff
jimratliff / test_of_jdrunicode_package.tex
Last active May 29, 2018 04:10
Test of jdrunicode package for LaTeX/Overleaf #latex #overleaf
\documentclass{article}
\usepackage{jdrunicode}
%
% See https://gist.github.com/jimratliff/122ea9f399ef3bc8c6df13bd7c5ee90f for the jdrunicode package
%
\begin{document}
\jdrunicode{⌘} \\ % Literal
\jdrunicode{\symbol{"2318}} \\ % Hexadecimal
\jdrunicode{\symbol{'21430}} \\ % Octal
\jdrunicode{\symbol{8984}} \\ % Decimal
@jimratliff
jimratliff / lists_key_labels_ASCII_virtual_key_codes.txt
Last active May 29, 2018 04:16
Lists of keyboard key labels, ASCII character codes, and virtual key codes #dotfiles #character_codes #symbolichotkeys
# The following three lists are, respectively, (a) the label on keyboard keys, (b) ASCII
# character codes, and (c) Virtual Key codes. All three are sorted by the label on the
# keyboard keys. Thus, each column is a triple (label, ASCII code, virtual key code)
# corresponding to a particular key.
jdr_dotfiles_sorted_key_labels=(0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 Keypad0 Keypad1 Keypad2 Keypad3 Keypad4 Keypad5 Keypad6 Keypad7 Keypad8 Keypad9 KeypadClear KeypadDecimal KeypadDivide KeypadEnter KeypadEquals KeypadMinus KeypadMultiply KeypadPlus Backslash CapsLock Comma Command Control Delete DownArrow End Equal Escape ForwardDelete Function Grave Help Home LeftArrow LeftBracket Minus Mute Opt
@jimratliff
jimratliff / LaTeX snippet: Insert graphic as figure.txt
Last active May 19, 2018 15:45
Insert graphic file as a figure. Assumes graphic file is located in directory "graphics". #latex #snippet
\begin{figure}[ht]
\centering
\includegraphics[width=\textwidth]{graphics/INSERT_FILE_NAME}
\caption{InsertCaptionHere} %Locate after figure contents to ensure caption is rendered below the figure
%\label{fig:INSERT_LABEL_HERE}
\end{figure}
@jimratliff
jimratliff / LaTeX snippet: Insert table of key symbols for model.txt
Last active May 19, 2018 15:42
Insert table of key symbols for model, with alternate rows shaded. Requires that color "tableShade" has been defined, e.g., "\definecolor{tableShade}{gray}{0.9}". #latex #snippet
\begin{table}[!htb] % p option positions table on its own page.
\label{table:summary_key_symbols}
\caption{Summary of key symbols in model}
\centering
\rowcolors{2}{tableShade}{white} % start alternating shades from 2nd row (not counting header)
\begin{tabular}[t]{>{\centering}m{0.2\linewidth} >{\raggedright\arraybackslash}m{0.7\linewidth}}
\toprule
Symbol & Meaning \\
\midrule
$x$ & Description. \\
@jimratliff
jimratliff / LaTeX: definition of set-theoretic difference.txt
Last active May 19, 2018 15:43
Insert definition of set-theoretic difference. #latex #snippet #text_snippet
The character $\setminus$ represents the set-theoretic difference operator. E.g., ${A \setminus B = \{x: x \in A \text{ and } x \notin B\}}$.
@jimratliff
jimratliff / LaTeX: definition of cardinality of a set.txt
Last active May 19, 2018 15:44
Insert definition of cardinality of a set. #latex #snippet #text_snippet
$\#S$ is the cardinality of set $S$, i.e., the number of elements in $S$.