Skip to content

Instantly share code, notes, and snippets.

@Drake81
Drake81 / parallel_curl.sh
Created August 24, 2016 10:19 — forked from CMCDragonkai/parallel_curl.sh
Bash: GNU Parallel with Curl
# do it once
seq 1 | parallel -n0 "curl -H 'Content-Type: application/json' http://httpbin.org/post -X POST -d '{\"url\":\"http://google.com/\"}'"
# do it twice
seq 2 | parallel -n0 "curl -H 'Content-Type: application/json' http://httpbin.org/post -X POST -d '{\"url\":\"http://google.com/\"}'"
# do it 4 times, but at 2 a time
seq 4 | parallel -n0 -j2 "curl -H 'Content-Type: application/json' http://httpbin.org/post -X POST -d '{\"url\":\"http://google.com/\"}'"
# you can also put all your commands into a file
@Drake81
Drake81 / astronauts.sql
Last active May 30, 2016 14:53
Sparql query on astronauts
# select all astronauts with name, image, birthdate, birthplace and coordinates of the birthplace
# https://query.wikidata.org/#%23%20select%20all%20astronauts%20with%20name%2C%20image%2C%20birthdate%2C%20birthplace%20and%20coordinates%20of%20the%20birthplace%0A%0ASELECT%20%3Fastronaut%20%3FastronautLabel%20%3Fimage%20%3Fbirthdate%20%3Fbirthplace%20%3Fcoord%20WHERE%20%7B%0A%20%20%3Fastronaut%20%3Fx1%20wd%3AQ11631%3B%0A%20%20wdt%3AP18%20%3Fimage%3B%0A%20%20wdt%3AP569%20%3Fbirthdate%3B%0A%20%20wdt%3AP19%20%3Fbirthplace%3B%0A%20%20wdt%3AP31%20wd%3AQ5.%0A%20%20%0A%20%20%3Fbirthplace%20wdt%3AP625%20%3Fcoord%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%7D%0A%7D%0AORDER%20BY%20DESC(%3Fbirthdate)
SELECT ?astronaut ?astronautLabel ?image ?birthdate ?birthplace ?coord WHERE {
?astronaut ?x1 wd:Q11631;
wdt:P18 ?image;
wdt:P569 ?birthdate;
wdt:P19 ?birthplace;
wdt:P31 wd:Q5.

PDF Testing Gist

These two files, pdf_linkchecker.py and pdf_fontchecker.py are code examples to go along with a blog article: http://reachtim.com/articles/PDF-Testing.html

See the article for details on how to test your PDFs for broken internal and external links and for unembedded fonts.

Keybase proof

I hereby claim:

  • I am Drake81 on github.
  • I am dr4k3 (https://keybase.io/dr4k3) on keybase.
  • I have a public key whose fingerprint is 51DB A6D0 671F 6BE9 23D3 5822 6CBE DC57 24EE 3426

To claim this, I am signing this object:

#!/usr/bin/perl
####### README ##################################################################{{{
#
# dmenuLauncher is a program launcher that saves number of calls and opional the
# arguments for each program.
#
# It uses dmenu to display the possible programs and select one.
#
# dmenuLauncher is designed to be small and fast so that even on old systems
@Drake81
Drake81 / words.erl
Created September 26, 2013 21:31
recursive word count in erlang
-module(words).
-export([start/0, wordcount/1, wordcount/2, count/1]).
% Count to 10
count(N) ->
if
N < 11 ->
io:format("~w~n", [N]),
count(N+1);
N > 10 ->