Skip to content

Instantly share code, notes, and snippets.

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 13:14
dump statistics on bibtext entries (number of pdfs, etc.)
#!/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 12:32
extract abstracts from pdfs from a bibtex entries, add abstracts to bibtex entries and write to STDOUT [needs pdftottext]
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
use IO::File;
use Data::Dumper;
use BibTeX::Parser;
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
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{}'
# 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"
#!/bin/bash
# set -x
VERSION="0.1.0"
GREP=
SENT=
DAYS=30
HOSTNAME=`hostname`
MAILDIR=$HOME/Maildir
# ~/.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 October 15, 2015 10:37
markdown to html for wordpress
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 October 6, 2015 14:10
Redmine holiday-API
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>