v3.0.0 "The Great Overhaul"
===================================================================== Notice the major version change which comes with breaking changes to 2.x! Reconstructs "library" functions for both python and zsh scwrypts, with changes to virtualenv naming conventions (you'll need to refresh all virtualenv with the appropriate scwrypt). --- Changes ------------------------------ - changed a naming convention across zsh scripts, particularly removing underscores where there is no need to avoid naming clash (e.g. 'zsh/lib/utils/io.zsh' renames '__STATUS' to 'STATUS') - moved clients reliant on py.lib.http to the py.lib.http module - python scripts now rely on py.lib.scwrypts.execute - updated package.json in zx scripts to include `type = module` - 'scwrypts --list' commandline argument now includes additional relevant data for each scwrypt - environment variables no longer add themselves to be staged in the '.env.template' --- New Features ------------------------- - new 'use' syntax for disjoint import within zsh scripts; took me a very long time to convince myself this would be necessary - introduced scwrypt "groups" to allow portable module creation; (i.e. ability add your own scripts from another repo!) - py.lib.scwrypts.io provides a combined IO stream for quick, hybrid use of input/output files and stdin/stdout - py.lib.fzf provides a wrapper to provide similar functionality to zsh/utils/io.zsh including fzf_(head|tail) - improved efficiency of various scwrypts; notably reducing runtime of scwrypts/environment sync - improved scwrypts CLI by adding new options for exact scwrypt matching, better filtering, and prettier/more-detailed interfaces --- New Scripts -------------------------- - py/twilio ) basic SMS integration with twilio - send-sms - py/directus ) interactive directus GET query - get-items - py/discord ) post message to discord channel or webhook - post-message
This commit is contained in:
31
zsh/office/latex/build-pdf
Executable file
31
zsh/office/latex/build-pdf
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use office/latex
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
PDFLATEX() {
|
||||
[ ! $1 ] && FAIL 1 'must provide filename'
|
||||
local FILENAME=$(LATEX__GET_MAIN_FILENAME "$1")
|
||||
|
||||
local ARGS=(-interaction=nonstopmode)
|
||||
ARGS+=("$FILENAME")
|
||||
|
||||
cd "$(dirname $FILENAME)"
|
||||
|
||||
STATUS 'running compile (1/2)'
|
||||
pdflatex ${ARGS[@]} \
|
||||
|| FAIL 2 'first compile failed (see above)'
|
||||
|
||||
STATUS 'running compile (2/2)'
|
||||
pdflatex ${ARGS[@]} >/dev/null 2>&1 \
|
||||
|| FAIL 3 'second compile failed :c'
|
||||
|
||||
SUCCESS "created '$(echo $FILENAME | sed 's/\.[^.]*$/.pdf/')'"
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
PDFLATEX $@
|
23
zsh/office/latex/cleanup
Executable file
23
zsh/office/latex/cleanup
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use office/latex
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
CLEAN_LATEX_LOGFILES() {
|
||||
local DIRECTORY=$(SCWRYPTS__GET_PATH_TO_RELATIVE_ARGUMENT ".")
|
||||
[ $1 ] && DIRECTORY="$(dirname "$(LATEX__GET_MAIN_FILENAME "$1")")"
|
||||
[ $DIRECTORY ] && [ -d $DIRECTORY ] \
|
||||
|| FAIL 1 'unable to parse valid directory'
|
||||
|
||||
cd $DIRECTORY
|
||||
rm $(ls | grep '\.\(aux\)\|\(log\)\|\(pdf\)\|\(out\)\|\(dvi\)$')
|
||||
|
||||
SUCCESS "cleaned up latex artifacts in '$DIRECTORY'"
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
CLEAN_LATEX_LOGFILES $@
|
62
zsh/office/latex/create-new
Executable file
62
zsh/office/latex/create-new
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use office/latex
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
TEMPLATE_DIR="${0:a:h}/templates"
|
||||
|
||||
CREATE_NEW_LATEX_DOCUMENT_FROM_TEMPLATE() {
|
||||
local DOCUMENT_DIR="$EXECUTION_DIR"
|
||||
local TEMPLATE=$(GET_TEMPLATES | FZF 'select a template')
|
||||
[ ! $TEMPLATE ] && ABORT
|
||||
SUCCESS "selected template '$TEMPLATE'"
|
||||
|
||||
INPUT DOC_TITLE 'document title' || ABORT
|
||||
|
||||
local DOCUMENT_FILE="$DOCUMENT_DIR/$(SLUGIFY_TITLE).tex"
|
||||
[ -f "$DOCUMENT_FILE" ] && FAIL 1 "'$(basename $DOCUMENT_FILE)' already exists"
|
||||
|
||||
INPUT DOC_ID 'document id/subtitle'
|
||||
INPUT AUTHOR 'author name'
|
||||
INPUT AUTHOR_ID 'author id/title'
|
||||
|
||||
{
|
||||
PRINT_TITLE_INFO
|
||||
cat "$TEMPLATE_DIR/$TEMPLATE/template.tex"
|
||||
} > "$DOCUMENT_FILE"
|
||||
cp "$TEMPLATE_DIR/gitignore" "$DOCUMENT_DIR/.gitignore"
|
||||
for FILE in $(find "$TEMPLATE_DIR/$TEMPLATE" -type f | grep -v '/template.tex$')
|
||||
do
|
||||
cp "$FILE" "$DOCUMENT_DIR/" || return 2
|
||||
done
|
||||
[[ ! $TEMPLATE =~ ^basic$ ]] \
|
||||
&& mkdir "$DOCUMENT_DIR/sections" "$DOCUMENT_DIR/graphics"
|
||||
|
||||
SUCCESS "finished generating '$(basename $DOCUMENT_FILE)' from '$TEMPLATE'"
|
||||
}
|
||||
|
||||
GET_TEMPLATES() {
|
||||
find "$TEMPLATE_DIR" -type d | sed "s^$TEMPLATE_DIR/*^^; /^$/d"
|
||||
}
|
||||
|
||||
PRINT_TITLE_INFO() {
|
||||
local DATESTRING=$(date '+%B %_d, %Y' | sed 's/ \{1,\}/ /g')
|
||||
sed "
|
||||
s^LATEX-DOC-TITLE^$DOC_TITLE^
|
||||
s^LATEX-DOC-DATE^$DATESTRING^
|
||||
s^LATEX-DOC-ID^$DOC_ID^
|
||||
s^LATEX-AUTHOR-NAME^$AUTHOR^
|
||||
s^LATEX-AUTHOR-ID^$AUTHOR_ID^
|
||||
" "$TEMPLATE_DIR/main.tex"
|
||||
}
|
||||
|
||||
SLUGIFY_TITLE() {
|
||||
echo $DOC_TITLE | sed "s^['\"\\/,\!@#\$%^&*()]*^^g; s^\s\+^-^g;"
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
CREATE_NEW_LATEX_DOCUMENT_FROM_TEMPLATE $@
|
10
zsh/office/latex/get-pdf
Executable file
10
zsh/office/latex/get-pdf
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use office/latex
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
LATEX__GET_PDF $@
|
18
zsh/office/latex/open-pdf
Executable file
18
zsh/office/latex/open-pdf
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use office/latex
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
OPEN_PDF() {
|
||||
local PDF=$(LATEX__GET_PDF $@)
|
||||
[ ! $PDF ] && return 1
|
||||
|
||||
OPEN "$PDF"
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
OPEN_PDF $@
|
37
zsh/office/latex/templates/basic/template.tex
Normal file
37
zsh/office/latex/templates/basic/template.tex
Normal file
@ -0,0 +1,37 @@
|
||||
\usepackage[margin=.75in,bottom=0.5in,top=1.0in]{geometry}
|
||||
|
||||
\usepackage{enumitem}
|
||||
\usepackage{fancyhdr}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{lastpage}
|
||||
|
||||
\newcommand{\headerL} {\documentTitle: \documentDate}
|
||||
\newcommand{\headerC} {\documentId}
|
||||
\newcommand{\headerR} {\authorName\ (\authorId)}
|
||||
\newcommand{\pageOfTotal} {\thepage\ of~\pageref{LastPage}}
|
||||
|
||||
\pagestyle{fancy}
|
||||
\fancypagestyle{plain}{%
|
||||
\fancyhf{}
|
||||
\fancyhead[L]{\headerL}\fancyhead[R]{\headerR}\fancyhead[C]{\headerC}
|
||||
\fancyfoot[C]{\pageOfTotal}
|
||||
}
|
||||
|
||||
\renewcommand{\baselinestretch}{1}
|
||||
\setlength{\parskip}{0em}
|
||||
\hyphenpenalty=5000%
|
||||
|
||||
\fancyhf{}
|
||||
\fancyhead[L]{\headerL}\fancyhead[R]{\headerR}\fancyhead[C]{\headerC}
|
||||
\fancyfoot[C]{\pageOfTotal}
|
||||
|
||||
\title{\documentTitle}
|
||||
\author{\authorName\ \\ \authorId}
|
||||
\date{\documentDate}
|
||||
|
||||
\begin{document}
|
||||
\maketitle%
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
% ---------------------------------------------------------------------
|
||||
\end{document}
|
5
zsh/office/latex/templates/gitignore
Normal file
5
zsh/office/latex/templates/gitignore
Normal file
@ -0,0 +1,5 @@
|
||||
*.aux
|
||||
*.log
|
||||
*.out
|
||||
*.pdf
|
||||
*.dvi
|
9
zsh/office/latex/templates/main.tex
Normal file
9
zsh/office/latex/templates/main.tex
Normal file
@ -0,0 +1,9 @@
|
||||
\documentclass[letterpaper]{article}
|
||||
|
||||
\newcommand{\documentTitle} {LATEX-DOC-TITLE}
|
||||
\newcommand{\documentDate} {LATEX-DOC-DATE}
|
||||
\newcommand{\documentId} {LATEX-DOC-ID}
|
||||
|
||||
\newcommand{\authorName} {LATEX-AUTHOR-NAME}
|
||||
\newcommand{\authorId} {LATEX-AUTHOR-ID}
|
||||
|
11
zsh/office/latex/templates/math/code.sty
Normal file
11
zsh/office/latex/templates/math/code.sty
Normal file
@ -0,0 +1,11 @@
|
||||
\ProvidesPackage{code}
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
\newcommand{\clispsnippet}[2]{%
|
||||
\lstinputlisting[%
|
||||
caption=#1,
|
||||
language=Lisp,
|
||||
showstringspaces=false,
|
||||
numbers=left,
|
||||
]{#2}
|
||||
}
|
46
zsh/office/latex/templates/math/formatting.sty
Normal file
46
zsh/office/latex/templates/math/formatting.sty
Normal file
@ -0,0 +1,46 @@
|
||||
\ProvidesPackage{formatting}
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
\newcommand{\headerLeft} {\documentTitle: \documentDate}
|
||||
\newcommand{\headerCenter} {\documentId}
|
||||
\newcommand{\headerRight} {\authorName\ (\authorId)}
|
||||
\newcommand{\pageOfTotal} {\thepage\ of~\pageref{LastPage}}
|
||||
|
||||
\newtheorem{theorem}{Theorem}[section]
|
||||
\newtheorem{lemma}[theorem]{Lemma}
|
||||
\newtheorem{corollary}{Corollary}[theorem]
|
||||
|
||||
\RequirePackage[margin=1in,bottom=.5in,includefoot]{geometry}
|
||||
\RequirePackage{lastpage}
|
||||
\RequirePackage{fancyhdr}
|
||||
|
||||
% ---------------------------------------------------------------------
|
||||
% Page 1
|
||||
|
||||
\pagestyle{fancy}
|
||||
\fancypagestyle{plain}{%
|
||||
\fancyhf{}
|
||||
\fancyhead[L]{\headerLeft}
|
||||
\fancyhead[R]{\headerRight}
|
||||
\fancyhead[C]{\headerCenter}
|
||||
\fancyfoot[C]{\pageOfTotal}
|
||||
}
|
||||
|
||||
\renewcommand{\baselinestretch}{1}
|
||||
\setlength{\parskip}{0em}
|
||||
\setlength{\parindent}{0em}
|
||||
|
||||
% ---------------------------------------------------------------------
|
||||
% Pages 2+
|
||||
|
||||
\fancyhf{}
|
||||
\fancyhead[L]{\headerLeft}
|
||||
\fancyhead[R]{\headerRight}
|
||||
\fancyhead[C]{\headerCenter}
|
||||
\fancyfoot[C]{\pageOfTotal}
|
||||
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
\title{\documentTitle}
|
||||
\author{\authorName\ \\ \authorId}
|
||||
\date{\documentDate}
|
0
zsh/office/latex/templates/math/gitignore
Normal file
0
zsh/office/latex/templates/math/gitignore
Normal file
16
zsh/office/latex/templates/math/imports.sty
Normal file
16
zsh/office/latex/templates/math/imports.sty
Normal file
@ -0,0 +1,16 @@
|
||||
\ProvidesPackage{imports}
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
\RequirePackage{amssymb} % "bold" math letters (e.g. set of integers ℤ)
|
||||
\RequirePackage{amsmath} % advanced math symbols
|
||||
|
||||
\RequirePackage{listings} % code snippet styling block
|
||||
|
||||
\RequirePackage{tikz} % graphic drawing / generation
|
||||
\usetikzlibrary{arrows,automata}
|
||||
\usetikzlibrary{trees}
|
||||
|
||||
\RequirePackage{graphicx} % include images
|
||||
\graphicspath{{./graphics/}}
|
||||
|
||||
\RequirePackage[english]{babel} % -- English compilation rules
|
13
zsh/office/latex/templates/math/shorthand.sty
Normal file
13
zsh/office/latex/templates/math/shorthand.sty
Normal file
@ -0,0 +1,13 @@
|
||||
\ProvidesPackage{shorthand}
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
\newcommand{\egfcoefficient}{\ensuremath{\left[\frac{x^n}{n!}\right]}}
|
||||
\newcommand{\ogfcoefficient}{\ensuremath{\left[x^n\right]}}
|
||||
\newcommand{\falling}[1]{^{\underline{#1}}}
|
||||
\newcommand{\divides}{\ensuremath{\;\backslash\;}}
|
||||
|
||||
\newcommand{\sumgz}{\ensuremath{\sum_{n\geq 0}}}
|
||||
\newcommand{\sumdiv}{\ensuremath{\sum_{d\divides n}}}
|
||||
|
||||
\newcommand{\union}{\ensuremath{\cup}}
|
||||
\newcommand{\intersect}{\ensuremath{\cap}}
|
12
zsh/office/latex/templates/math/template.tex
Normal file
12
zsh/office/latex/templates/math/template.tex
Normal file
@ -0,0 +1,12 @@
|
||||
\usepackage{imports}
|
||||
\usepackage{formatting}
|
||||
\usepackage{shorthand}
|
||||
\usepackage{code}
|
||||
|
||||
\begin{document}
|
||||
\maketitle
|
||||
% ---------------------------------------------------------------------
|
||||
% \input{sections/01.introduction.tex}
|
||||
% \includegraphic{graphics/diagram-a.png}
|
||||
% ---------------------------------------------------------------------
|
||||
\end{document}
|
@ -0,0 +1,7 @@
|
||||
\ProvidesPackage{custom-headers}
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
\newcommand{\firstH}[1] {\begin{large}\textbf{#1}\end{large}\par}
|
||||
\newcommand{\secondH}[1] {\textbf{#1}\par}
|
||||
\newcommand{\thirdH}[1] {\textbf{#1}. }
|
||||
\newcommand{\fourthH}[1] {\textbf{\textit{#1}}. }
|
31
zsh/office/latex/templates/times-new-roman-12/formatting.sty
Normal file
31
zsh/office/latex/templates/times-new-roman-12/formatting.sty
Normal file
@ -0,0 +1,31 @@
|
||||
\ProvidesPackage{formatting}
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
\newcommand{\horizontalHeader} {%
|
||||
\authorName\hfill
|
||||
\authorId\hfill
|
||||
\documentId\hfill
|
||||
\documentDate%
|
||||
}
|
||||
|
||||
\RequirePackage[margin=1in]{geometry}
|
||||
\RequirePackage{fancyhdr}
|
||||
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
\pagestyle{fancy}
|
||||
\renewcommand{\headrulewidth}{0pt}
|
||||
\fancyhead[C]{\horizontalHeader}
|
||||
\fancyfoot[C]{\thepage}
|
||||
|
||||
\renewcommand{\baselinestretch}{1}
|
||||
\setlength{\parskip}{1em}
|
||||
\setlength{\parindent}{0em}
|
||||
\raggedright%
|
||||
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
\newcommand{\insertTitle} {%
|
||||
\centerline{\begin{large}\textbf{\documentTitle}\end{large}}
|
||||
}
|
||||
|
11
zsh/office/latex/templates/times-new-roman-12/imports.sty
Normal file
11
zsh/office/latex/templates/times-new-roman-12/imports.sty
Normal file
@ -0,0 +1,11 @@
|
||||
\ProvidesPackage{imports}
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
\RequirePackage{times} % "Times New Roman" font
|
||||
|
||||
\RequirePackage{kantlipsum} % generate Kantian lorem ipsum
|
||||
|
||||
\RequirePackage{graphicx} % include images
|
||||
\graphicspath{{./graphics/}}
|
||||
|
||||
\RequirePackage[english]{babel} % -- English compilation rules
|
15
zsh/office/latex/templates/times-new-roman-12/template.tex
Normal file
15
zsh/office/latex/templates/times-new-roman-12/template.tex
Normal file
@ -0,0 +1,15 @@
|
||||
\usepackage{imports}
|
||||
\usepackage{formatting}
|
||||
\usepackage{custom-headers}
|
||||
|
||||
\begin{document}
|
||||
\insertTitle%
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
% \input{sections/abstract.tex}
|
||||
% \includgraphics{graphics/table-a.png}
|
||||
\firstH{First-level Header}
|
||||
\kant%
|
||||
|
||||
% ---------------------------------------------------------------------
|
||||
\end{document}
|
Reference in New Issue
Block a user