Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# set -x
VERSION="0.1.0"
GREP=
SENT=
DAYS=30
HOSTNAME=`hostname`
MAILDIR=$HOME/Maildir
# 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"
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{}'
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
@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;
@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;
use v6;
use Test;
plan 12;
$_ = "here is some foo";
my $rx1 = "some foo";
my $rx2 = "(some) foo";