Skip to content

Instantly share code, notes, and snippets.

@mayjs
mayjs / extract_labels.py
Last active November 23, 2016 12:13
Extract LaTeX labels from .aux files generated by pdflatex
import argparse
import sys
import re
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Extract LaTeX labels")
parser.add_argument("file", metavar="FILE", type=argparse.FileType("r"))
parser.add_argument("-o", "--output", metavar="OUTPUT_FILE", default=sys.stdout, type=argparse.FileType("w"))
args = parser.parse_args()
@mayjs
mayjs / watchfile.sh
Created May 1, 2016 17:52 — forked from swarminglogic/watchfile.sh
watchfile - monitor file(s) and execute a command when files are changed
#!/bin/bash
version=1.0.1
versionDate="2014-02-14"
function showHelp() {
echo "watchfile - monitor file(s)/command and perform action when changed
Possible ways of usage
----------------------------------------
// ==UserScript==
// @name HideFBMainPage
// @namespace thekemiren@googlemail.com
// @include https://www.facebook.com/?*
// @include https://www.facebook.com/*
// @version 1
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle("#contentCol.newsFeedComposer #contentArea{opacity:0.0000001 !important;}");
@mayjs
mayjs / preprocessor_fun.h
Created December 15, 2015 11:27 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@mayjs
mayjs / System Properties
Created November 23, 2014 17:24
Java stuff
List all Properties and values in the console:
System.getProperties().list(System.out);
@mayjs
mayjs / Numbers
Created November 17, 2014 22:57
Useful regular expressions
\d+ Checks for positive (unsigned) integers
-?\d+ Checks for positive and negative (signed and unsigned) integers
-\d+ Checks for negative (signed) integers
-?\d*(\.\d+)? Checks for positive and negative decimals.
-?\d*(\.\d{n})? Checks for positive and negative decimals with precision n.
-?\d*(\.\d{n,m})? Checks for positive and negative decimals with a precision between n and m
-?\d*(\.\d{n,})? Checks for positive and negative decimals with a precision greater then or equal to n