Skip to content

Instantly share code, notes, and snippets.

View gist:b50968daa9c5f1ba137e50f11fca6ff4
use v6;
use Test;
plan 12;
$_ = "here is some foo";
my $rx1 = "some foo";
my $rx2 = "(some) foo";
@xdbr
xdbr / bib-stats
Created May 20, 2016
dump statistics on bibtext entries (number of pdfs, etc.)
View bib-stats
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
use IO::File;
use Data::Dumper;
use BibTeX::Parser;
@xdbr
xdbr / abstract-extractor
Created May 20, 2016
extract abstracts from pdfs from a bibtex entries, add abstracts to bibtex entries and write to STDOUT [needs pdftottext]
View abstract-extractor
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
use IO::File;
use Data::Dumper;
use BibTeX::Parser;
View quick'n'dirty extraction of abstracts from a list of pdfs on the commandline
for i in *.pdf ; do pdftotext "$i" - | perl -F/\\n\\n/ -0 -lane 'BEGIN { $FILE=shift @ARGV} print "$FILE:\t$_" for grep { $_ !~ /^\s*$/ } map { s/\n/ /g; $_ } grep { /^abstract/i } @F' "$i"; done
View newsay
language="${1-de}"
[[ "$language" == "de" ]] && curl -s http://sprichwortrekombinator.de/ | pup -p '.spwort text{}'
[[ "$language" == "en" ]] && curl -s http://proverb.gener.at/or/ | pup -p '.spwort text{}'
View paperize
# Needs httpie and pandoc installed. Takes URL and (ideally) spits out readable PDF
[[ $# != 2 ]] && echo "Usage:\n\t$(basename $0) <URL> <OUTPUT.pdf>" && exit 1
http --body heckyesmarkdown.com/go/ read==1 md==1 u=="$1" | pandoc --latex-engine=xelatex --from markdown --output "$2"
View mailstats
#!/bin/bash
# set -x
VERSION="0.1.0"
GREP=
SENT=
DAYS=30
HOSTNAME=`hostname`
MAILDIR=$HOME/Maildir
View gist:ce05c54a46073dc0e072
# ~/.tmuxinator/fpm.yml
name: fpm
root: ~/code/agenten/fpm
# Optional tmux socket
# socket_name: foo
# Runs before everything. Use it to start daemons etc.
# pre: sudo /etc/rc.d/mysqld start
@xdbr
xdbr / gist:72dc565aa59dbf403566
Last active Oct 15, 2015
markdown to html for wordpress
View gist:72dc565aa59dbf403566
cat <(echo '<style>code {display: inline;padding: 2px;border: none;}</style>') input.html | perl -MHTML::Entities -pe 's{<pre><code>}{<pre>}g; s{</code></pre>}{</pre>}g; decode_entities $_'
@xdbr
xdbr / holiday.sh
Created Oct 6, 2015
Redmine holiday-API
View holiday.sh
URL=https://redmine.your-company.com APIKEY=YOURPERSONALAPIKEY MESSAGE="Holiday" HOURS=8.0 ISSUE_ID=issue_id_here LC_ALL=C; \
for weekday in 2015-09-{21..30} 2015-10-{01..04}; do
case $((date -jf '%F' $weekday || date -d $weekday) 2>/dev/null | awk '{print $1}') in
(Mon|Tue|Wed|Thu|Fri) \
printf "Entering $weekday... " && \
echo '<time_entry>
<issue_id>${ISSUE_ID}</issue_id>
<hours>${HOURS}</hours>
<comments>${MESSAGE}</comments>
<spent_on>'${weekday}'</spent_on>
You can’t perform that action at this time.