Skip to content

Instantly share code, notes, and snippets.

Crunching numbers

Benjamin Morgan bjmorgan

Crunching numbers
View GitHub Profile
bjmorgan / compile
Last active Jan 2, 2019 — forked from CameronDevine/compile
A bash script for compiling JOSS and JOSE papers locally
View compile
#!/usr/bin/env bash
# Help text
description="A bash script for compiling JOSS and JOSE papers locally";
doc="compile [-j <journal>] [-d <doi>] [-v <volume>] [-i <issue>] [-p <page>]
[-s <submitted>] [-u <published>] [-r <review>] [-g <repository>] [-a <archive>] FILE
Compile a markdown FILE to a JOSS or JOSE paper.
bjmorgan /
Created Aug 22, 2018
Python script for reporting runtime environment
#! /usr/bin/env python3
import platform
import pip
import sys
def pip_freeze():
from pip._internal.operations import freeze
except ImportError: # pip < 10.0
bjmorgan / VASP_5.4.4_VDATCAR_patch
Created Nov 18, 2017
patch for VASP 5.4.4 to write velocities in A/fs to VDATCAR
View VASP_5.4.4_VDATCAR_patch
*** vasp.5.4.4/src/main.F Sat Nov 18 09:31:39 2017
--- vasp.5.4.4.vel/src/main.F Sat Nov 18 13:18:45 2017
*** 479,484 ****
--- 479,485 ----
bjmorgan / Find in OmniFocus.scpt
Last active Dec 24, 2015
AppleScript for triggering a search in OmniFocus from LaunchBar. Accepts text items from Launchbar (hit space, or send a text item to the script), or prompts the user for a search query.
View Find in OmniFocus.scpt
on handle_string(the_string)
if (length of the_string is 0) then
display dialog "Search OmniFocus for:" default answer ""
end if
open location "x-launchbar:hide"
my search_in_omnifocus(the_string)
end handle_string
on search_in_omnifocus(the_search_string)
tell application "OmniFocus"
bjmorgan / activation_energies.rb
Last active Dec 23, 2015
Calculates activation energies from a set of `T y` data (see example `data.dat`) (in eV), according to the Arrhenius equation. Uses a linear regression around `r` points away from each point considered to calculate the local slope.
View activation_energies.rb
# September 16, 2013
require 'optparse'
options = {}
executable_name = File.basename($PROGRAM_NAME)
bjmorgan / meansqerror.rb
Created Jun 26, 2013
Calculated the mean squared error between data in two files. Files should be single columns of the same length.
View meansqerror.rb
#! /home/morgan/bin/ruby/bin/ruby
# Calculates the mean squared error between two data sets
# BJM 26/06/13
def check_files_exist( filenames )
all_files_exist = true
filenames.each do |filename|
bjmorgan / Default (OSX).sublime.keymap
Last active Dec 15, 2015
Sublime Text 2 plugin for inserting \ref{<reference string>} code into LaTeX documents. The plugin scans the file for \label{<reference string>} commands (ignoring those in commented out lines), and presents a drop-down list of <reference string> options, alphabetically sorted. The keymappings given here bind the command to ⌘-l, ⌘-r.
View Default (OSX).sublime.keymap
// Run LaTeX plugin to insert reference code
"keys": ["super+l", "super+r"],
"command": "insert_latex_reference",
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex" }
bjmorgan / Sections.tmPreferences
Created Dec 21, 2012
Modified symbol matching ( TM | SL2 ) preference file for LaTeX. This presents the different sections indented according to their hierarchy.
View Sections.tmPreferences
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>Symbol List</string>
bjmorgan / figure.latex.sublime-snippet
Last active Dec 10, 2015
Sublime Text 2 snippet for inserting code for a `figure` environment. Triggered with `"figure"+tab`.
View figure.latex.sublime-snippet
\resizebox{${3:8.5}cm}{!}{\includegraphics*{${1:filename}.eps}} % $4
bjmorgan / table.latex.sublime-snippet
Created Dec 21, 2012
Sublime Text 2 snippet for inserting a `table` environment, triggered by `"table"+tab`
View table.latex.sublime-snippet
$0 \\\\