Skip to content

Instantly share code, notes, and snippets.

View daverosoff's full-sized avatar

Dave Rosoff daverosoff

  • The College of Idaho
  • Caldwell, ID
View GitHub Profile
@daverosoff
daverosoff / add_commits_to_branch.sh
Last active January 24, 2022 18:04
Create random git commits
# the delays are to make sure the
# filesystem catches up before the next git command
# begins.
function add_commits_to_branch() {
if [[ $# < 2 ]]; then
echo "Usage: random_git branch num_commits [branch num_commits]*"
fi
TIMESTAMP=$(date +%F-%H%M%S)
FNAME="${TIMESTAMP}.file"
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
##
# Creates an alias called "git hist" that outputs a nicely formatted git log.
# Usage is just like "git log"
# Examples:
# git hist
# git hist -5
# git hist <branch_name>
# git hist <tag_name> -10
##
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short"
@daverosoff
daverosoff / pretextual-emmet-cheat-sheet-mac.tex
Last active August 17, 2018 21:40
Useful shortcuts for Sublime Text 3 with PreTeXtual and Emmet (Mac)
\documentclass{article}
% \usepackage{pdflscape}
\usepackage{fancyhdr,titling,lipsum,enumitem,fontawesome}
\usepackage{multicol}
\usepackage[os=mac]{menukeys}
\usepackage[usegeometry]{typearea}% before geometry!
\usepackage{geometry}
\usepackage{hyperref}
\geometry{
@daverosoff
daverosoff / pretextual-emmet-cheat-sheet-win.tex
Last active August 17, 2018 21:51
Useful shortcuts for Sublime Text 3 with PreTeXtual and Emmet (Windows)
\documentclass{article}
% \usepackage{pdflscape}
\usepackage{fancyhdr,titling,lipsum,enumitem,fontawesome}
\usepackage{multicol}
\usepackage[os=win]{menukeys}
\usepackage[usegeometry]{typearea}% before geometry!
\usepackage{geometry}
\usepackage{hyperref}
\geometry{
@daverosoff
daverosoff / exalt-guide.md
Last active August 9, 2018 19:01
Validating PreTeXt/XML with Exalt in Sublime Text 3

Validating PreTeXt/XML with Exalt in Sublime Text 3

Introduction

This document shows you how to validate your PreTeXt source files against the RELAX-NG schema. (It's not necessary to validate against the Schematron rules this way, see the Author's Guide for details.)

Note that the procedure depends on the location of the schema file on disk, so that you will have to do this slightly differently in different computing environments.

ptx-check() {
java\
-classpath /home/vagrant/jing-trang/build\
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration\
-jar /home/vagrant/jing-trang/build/jing.jar\
/vagrant/mathbook/schema/pretext.rng "$1"
}
@daverosoff
daverosoff / idaho-latex.xsl
Last active August 22, 2016 05:27
LaTeX XSLT stylesheet for Survey of Algebra and Probability
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="../xsl/mathbook-latex.xsl" />
<xsl:output method="text" />
<xsl:param name="latex.preamble.late">
\setcounter{chapter}{-1}
\newcounter{mysection}
@daverosoff
daverosoff / idaho-html.xsl
Last active January 17, 2018 05:40
HTML XSLT stylesheet for Survey of Algebra and Probability
<?xml version="1.0" encoding="UTF-8"?> <!-- As XML file -->
<!-- For College of Idaho, -->
<!-- 2016/07/29 R. Beezer, implemented "letter numbers" for sections, -->
<!-- to match existing WeBWorK problem collection -->
<!-- Identify as a stylesheet -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- Import the usual LaTeX conversion templates -->
@daverosoff
daverosoff / clean-mat101-tables.md
Last active July 14, 2016 20:56
clean-mat101-tables

Keyboard shortcuts:

  • Move current line up/down: Ctrl-Shift-Up/Ctrl-Shift-Down
  • Select word containing caret: Ctrl-D
  • Expand selection to tags: Ctrl-M
  • Expand selection to brackets: Ctrl-Shift-M
  • Glue into one huge line: Ctrl-A, Ctrl-J
  • Indent XML: Ctrl-K, Ctrl-,

Regular expressions for fixing tables: