Skip to content

Instantly share code, notes, and snippets.

@t-bltg
t-bltg / kmeans.pyx
Last active February 22, 2017 17:36 — forked from dwf/kmeans.pyx
Parallelized k-means in Cython.
"""
Parallelized k-means module.
By David Warde-Farley, February 2012. Licensed under the 3-clause BSD.
FROM gist.github.com/dwf/2200359
"""
cimport cython
from cython.parallel import prange
import numpy as np
cimport numpy as np
@t-bltg
t-bltg / emacs-fortran-formating-script.lisp
Created August 8, 2016 20:15
Emacs fortran formatting script, according to emacs/lisp/progmodes/f90.el
(defun f90-batch-indent-region ()
"Run `f90-batch-beatify-region' on the specified filename.
Use this from the command line, with `-batch';
it won't work in an interactive Emacs.
For example, invoke \"emacs -batch -l ~/.emacs-batch-f90-indent -f f90-batch-indent-region file.f\""
(if (not noninteractive)
(error "`f90-batch-indent-region' is to be used only with -batch"))
(let ((make-backup-files nil)
(version-control nil)
(auto-save-default nil)
@t-bltg
t-bltg / emacs-fortran-formating-script.lisp
Created August 8, 2016 20:15
Emacs fortran formatting script, according to emacs/lisp/progmodes/f90.el
(defun f90-batch-indent-region ()
"Run `f90-batch-beatify-region' on the specified filename.
Use this from the command line, with `-batch';
it won't work in an interactive Emacs.
For example, invoke \"emacs -batch -l ~/.emacs-batch-f90-indent -f f90-batch-indent-region file.f\""
(if (not noninteractive)
(error "`f90-batch-indent-region' is to be used only with -batch"))
(let ((make-backup-files nil)
(version-control nil)
(auto-save-default nil)
@t-bltg
t-bltg / emacs-fortran-formating-script.lisp
Created August 8, 2016 20:15
Emacs fortran formatting script, according to emacs/lisp/progmodes/f90.el
(defun f90-batch-indent-region ()
"Run `f90-batch-beatify-region' on the specified filename.
Use this from the command line, with `-batch';
it won't work in an interactive Emacs.
For example, invoke \"emacs -batch -l ~/.emacs-batch-f90-indent -f f90-batch-indent-region file.f\""
(if (not noninteractive)
(error "`f90-batch-indent-region' is to be used only with -batch"))
(let ((make-backup-files nil)
(version-control nil)
(auto-save-default nil)
@t-bltg
t-bltg / emacs-fortran-formating-script.lisp
Created August 8, 2016 20:15
Emacs fortran formatting script, according to emacs/lisp/progmodes/f90.el
(defun f90-batch-indent-region ()
"Run `f90-batch-beatify-region' on the specified filename.
Use this from the command line, with `-batch';
it won't work in an interactive Emacs.
For example, invoke \"emacs -batch -l ~/.emacs-batch-f90-indent -f f90-batch-indent-region file.f\""
(if (not noninteractive)
(error "`f90-batch-indent-region' is to be used only with -batch"))
(let ((make-backup-files nil)
(version-control nil)
(auto-save-default nil)
@t-bltg
t-bltg / emacs-fortran-formating-script.lisp
Created August 8, 2016 20:15
Emacs fortran formatting script, according to emacs/lisp/progmodes/f90.el
(defun f90-batch-indent-region ()
"Run `f90-batch-beatify-region' on the specified filename.
Use this from the command line, with `-batch';
it won't work in an interactive Emacs.
For example, invoke \"emacs -batch -l ~/.emacs-batch-f90-indent -f f90-batch-indent-region file.f\""
(if (not noninteractive)
(error "`f90-batch-indent-region' is to be used only with -batch"))
(let ((make-backup-files nil)
(version-control nil)
(auto-save-default nil)
@t-bltg
t-bltg / emacs-fortran-formating-script.lisp
Created August 8, 2016 20:15
Emacs fortran formatting script, according to emacs/lisp/progmodes/f90.el
(defun f90-batch-indent-region ()
"Run `f90-batch-beatify-region' on the specified filename.
Use this from the command line, with `-batch';
it won't work in an interactive Emacs.
For example, invoke \"emacs -batch -l ~/.emacs-batch-f90-indent -f f90-batch-indent-region file.f\""
(if (not noninteractive)
(error "`f90-batch-indent-region' is to be used only with -batch"))
(let ((make-backup-files nil)
(version-control nil)
(auto-save-default nil)
@t-bltg
t-bltg / emacs-fortran-formating-script.lisp
Created August 8, 2016 20:15
Emacs fortran formatting script, according to emacs/lisp/progmodes/f90.el
(defun f90-batch-indent-region ()
"Run `f90-batch-beatify-region' on the specified filename.
Use this from the command line, with `-batch';
it won't work in an interactive Emacs.
For example, invoke \"emacs -batch -l ~/.emacs-batch-f90-indent -f f90-batch-indent-region file.f\""
(if (not noninteractive)
(error "`f90-batch-indent-region' is to be used only with -batch"))
(let ((make-backup-files nil)
(version-control nil)
(auto-save-default nil)
@t-bltg
t-bltg / ocrpdf.sh
Created May 19, 2016 13:38 — forked from wcaleb/ocrpdf.sh
Take a PDF, OCR it, and add OCR Text as background layer to original PDF to make it searchable
#!/bin/sh
# Take a PDF, OCR it, and add OCR Text as background layer to original PDF to make it searchable.
# Hacked together using tips from these websites:
# http://www.jlaundry.com/2012/ocr-a-scanned-pdf-with-tesseract/
# http://askubuntu.com/questions/27097/how-to-print-a-regular-file-to-pdf-from-command-line
# Dependencies: pdftk, tesseract, imagemagick, enscript, ps2pdf
# Would be nice to use hocr2pdf instead so that the text lines up with the PDF image.
# http://www.exactcode.com/site/open_source/exactimage/hocr2pdf/
@t-bltg
t-bltg / Indentation Rules.tmPreferences
Last active December 10, 2015 19:32 — forked from albertxing/Indentation Rules.tmPreferences
LaTeX indentation rules for Sublime Text. See usage in comments below.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Indentation Rules</string>
<key>scope</key>
<string>text.tex, sources.bib</string>
<key>settings</key>
<dict>