Skip to content

Instantly share code, notes, and snippets.

View blahah's full-sized avatar

Rik Smith-Unna blahah

  • upward spiral ∞⟨X∴↯⟩∞
  • Bristol / Berlin / Nairobi
  • X @blahah404
View GitHub Profile
@blahah
blahah / install_node.md
Created May 20, 2016 12:49
Node installation instructions

installing Node.js

Whatever operating system you use, you'll need to install Node.js. We recommend doing this using nvm - the node version manager. Your machine should come with at least one of curl or wget. You can use either to install nvm:

curl version:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash
@blahah
blahah / getwileydoi.sh
Created May 19, 2016 04:48
download a wiley PDF by DOI
#!/bin/sh
wget \
--header "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36" \
--verbose \
--save-cookies cookies.txt \
--keep-session-cookies \
--content-disposition \
http://onlinelibrary.wiley.com/doi/$1/pdf \
-O `echo "$1" | tr '/' '☍'`.pdf
@blahah
blahah / eupmc_db_opts.json
Created April 22, 2016 12:18
Europe PMC lite open access metadata - 10,000 document sample for testing yunodb
{
"keyField": "$.identifier[?(@.type === 'pmcid')].id",
"indexMap": {
"title": true,
"author[*].surname": true,
"year": false
}
}
@blahah
blahah / optimise_eupmc.js
Last active April 18, 2016 17:37
europe pubmed central bibJSON -> search index optimised term array
#!/usr/bin/env node
// this script optimises the eupmc metadata for inclusion in a full-text
// search index.
var Transform = require("stream").Transform
var util = require("util")
var natural = require('natural')
var tokenize = (new natural.TreebankWordTokenizer()).tokenize
@blahah
blahah / README.md
Created April 17, 2016 07:34
Comparison of embedded NoSQL databases that can be emedded in a Node.js - Electron app

Making an Electron app and want to embed a database? Here's a table to help you choose the right database software.

Work in progress

Project Language NPM package? Flat file? In memory? Full-text search? Maturity Embedded size Dependencies
NeDB Javascript Yes Always No High Low Simple
Lunr Javascript No Yes Yes High Tiny None
Search-index Javascript
Sqlite3 C Yes No Yes (fts extens
@blahah
blahah / demo.sh
Last active April 11, 2016 16:25
UNIX one-liner to split a EuropePMC XML archive into a stream of articles
sed '1d;$d' | sed 's/<\/article>/<\/article>♛/g' | tr -d '\n' | tr '♛' '\n' | less -S
# e.g. download every EuropePMC archive and convert them to a stream of all articles
curl --silent http://europepmc.org/ftp/oa/ | \
grep -o 'PMC[0-9]*_PMC[0-9]*\.xml\.gz' | \
sort | uniq | \
sed 's/^/http:\/\/europepmc.org\/ftp\/oa\//' | \
xargs -n 1 curl --silent | gunzip | grep -vP '<\/?articles>' | \
sed 's/<\/article>/<\/article>♛/g' | tr -d '\n' | tr '♛' '\n' | less -S
@blahah
blahah / .block
Last active April 5, 2016 12:01 — forked from mbostock/.block
Programmatic Pan+Zoom
license: gpl-3.0
{
"options": {
"died": true,
"multigraph": true,
"compound": true
},
"nodes": [
{
"v": "questions",
"value": {
@blahah
blahah / concept-graph.js
Last active May 21, 2019 18:58 — forked from kanesee/concept-graph.js
d3 2-way tree
var CollapsibleTree = function(elt) {
var m = [20, 120, 20, 120],
w = 1280 - m[1] - m[3],
h = 580 - m[0] - m[2],
i = 0,
root,
root2;
var tree = d3.layout.tree()
prefix publisher journals dois
10.12679 0 0
10.7579 123Doc Education 0 0
10.3731 21st Century COE Program (Toplogical Science and Technology) 1 40
10.5775 A. I. Rosu Cultural Scientific Foundation Fundatia cultural-stiintifica A. I. Rosu 1 80
10.4037 AACN Publishing 2 766
10.1306 AAPG/Datapages 4 21817
10.3183 AB Svensk Papperstidning 1 1550
10.5769 ABEAT - Associacao Brasileira de Especialistas em Alta Tecnologia 1 57
10.7597 ACOPIOS - Revista Iberica de Mineralogia 1 9