Skip to content

Instantly share code, notes, and snippets.

View mKaloer's full-sized avatar

Mads Kalør mKaloer

  • kaunt
  • Denmark
View GitHub Profile
@mKaloer
mKaloer / pre-commit
Last active August 29, 2015 14:06
chktex pre-commit hook for git
#!/bin/sh
# Run chktex on 'report.tex'. Notice that this does not only test the staged files due
# to the recursive nature of chktex, but everything referenced by 'report.tex'.
# The chktex exit code cannot be used to distinguish a
# well formatted LaTeX document and a bad-formatted document, so we do that by grepping
# warings in the output. If the word "warning" has been written to the output, the output
# is printed to stdout. Also remove some chktex warnings of the form "chktex: WARNING --".
BODY=$(
output="$(chktex -q -V report.tex 2>&1 | grep -v 'chktex: WARNING --')";
warn=$(echo $output | grep Warning);

Keybase proof

I hereby claim:

  • I am mkaloer on github.
  • I am mkaloer (https://keybase.io/mkaloer) on keybase.
  • I have a public key whose fingerprint is 0642 8003 5E17 23BF D099 8E7C 1403 E1A1 B57A 59B2

To claim this, I am signing this object:

@mKaloer
mKaloer / guid_compare.py
Created November 9, 2016 07:37
Python implementation of comparison algorithm for SQL Server GUID (uniqueidentifier)
def less_than_guid(a,b):
"""
This implements the weird comparison method for sql server
GUID.
"""
groups = [slice(10,16), slice(8,10), slice(6,8), slice(4,6), slice(0,4)]
for g in groups:
if a.bytes[g] < b.bytes[g]:
return True
elif a.bytes[g] > b.bytes[g]: