Skip to content

Instantly share code, notes, and snippets.

@douglas
douglas / update_git_repos.sh
Created October 14, 2011 15:04
Update all git repositories under a base directory
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
# TexPublish - Preparing LaTeX Projects for Publication with Ease
# URL: https://gist.github.com/samuelsaari/07cfff92e157fad84cd9d1988e108d95
# Author: Miika Mäki https://github.com/samuelsaari
# - creates a new directory for publishable files
# - copies files matching user defined regular expressions to the new directory
# - copies all desired files that are used by the main tex document (like figures and tables)
# - creates a parsed bibliography that includes only entries used by the main tex file
# - flattens the tex file (inserts \input and \include commands and custom preambles in the main tex file)
# - pastes the parsed bibliography to the flattened tex file if desired
@yig
yig / latexmk-ding
Created January 15, 2016 04:43
Runs latexmk in continuous mode. Runs quickly (draft mode followed by batch mode). Plays a ding sound when finished. Also copies the PDF aside, so that PDF viewers don't get confused by the partially-written PDF files.
#!/bin/bash
## I used cfxr to create a coin sound. afplay is an OS X command line sound playback tool.
DING='afplay -v .01 /mixed\ media/music/cfxr\ coin.wav'
## Silence the ding.
# DING=''
## Simple continuous ding with draft mode followed by a batch mode run which actually generates the PDF.
## Copies the PDF with the suffix -copy.pdf, so that live-updating PDF viewers don't choke trying to load the PDF while it is still being written.
### We can't distinguish between the first time latexmk launches the viewer regardless of changes and later launches of the viewer with changes.
param (
[string]$NewWorkDir = $( Read-Host 'New work dir' ),
[string]$Branch = $( Read-Host 'Branch' )
)
$gitDir = git rev-parse --git-dir
if (!$gitDir) {
exit 128
}