Skip to content

Instantly share code, notes, and snippets.

View tjol's full-sized avatar

Thomas Jollans tjol

View GitHub Profile
@tjol
tjol / Makefile
Last active August 6, 2019 11:29
Building complex LaTeX documents with GNU make and automatic dependency resolution
# Global system configuration
LATEXMK=latexmk
LATEXMK_FLAGS=-lualatex -interaction=nonstopmode
GAWK=gawk
EXTRACT_DEPS_AWK=get-deps-from-latexmk.awk
# What documents shall we build?
TEXFILES=thesis.tex
# ################################################################# #
@tjol
tjol / fix_tex_accents.py
Last active February 21, 2019 13:29
Script to replace é with \'{e} and other such nonsense.
#!/usr/bin/env python3
"""
Short script to replace certain special characters (that happened to be in a
particular .bib file of mine) with their TeX codes. This is necessary because
UTF-8 support in classic BibTeX is abominable.
"""
import sys
import unicodedata
@tjol
tjol / fix-file-encoding.py
Created August 18, 2018 07:57
Script to fix file name encodings
#!/usr/bin/env python3
"""Script to fix pre-UTF8 file names in a directory (on Linux).
This iterates through a directory and finds all file names that
can't be decoded using the default encoding (should be UTF-8),
then tries to figure out what the file name should have been.
"""
import argparse
import os
@tjol
tjol / run_in_env.cmd
Created August 10, 2018 12:12
Script to run a program in a conda env on Windows
@ECHO OFF
REM ===============================================================
REM Windows CMD script to run a command in a conda environment.
REM
REM Useful for desktop shortcuts etc.
REM
REM Usage: ...\run_in_env.cmd env-name command
REM
REM As usual this will open a CMD window, but it closes as soon
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals, print_function
import sys
import os.path
import subprocess
import tempfile
import shutil
script = 'print(__file__)\n'
@tjol
tjol / emperor.pot
Created June 24, 2012 22:31
Emperor PO template as of commit 5267fe2, dated 2012-06-25
# Emperor - Orthodox file manager for GNOME
# Copyright (C) 2012 Thomas Jollans
# This file is distributed under the same license as the Emperor package.
# Thomas Jollans <t@jollybox.de>, 2012.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: emperor 0.2dev\n"
"Report-Msgid-Bugs-To: \n"
@tjol
tjol / find_lib.py
Created September 28, 2011 10:28
Find dynamically linked libraries.
#!/usr/bin/python
# Run as: find_lib.py [executable] [search-string]
import sys
import subprocess
exec_name = sys.argv[1]
search_for = sys.argv[2]
examined = []
"""
Python 3 solution to Xah Lee's infamous crosspost of July 17 2011.
License; Chicken Dance License version 0.2 or newer.
For the license and dance, see https://github.com/supertunaman/cdl
"""
import os
import os.path
from concurrent.futures import ProcessPoolExecutor