Skip to content

Instantly share code, notes, and snippets.

@lwrubel
lwrubel / csv-to-ris-format.py
Last active December 21, 2022 20:56
Convert csv exported from Google Sheets to RIS format. To use: python csv-to-ris-format.py infile.csv outfile.txt
#!/usr/bin/env python
# To use:
# python csv-to-ris-format.py csvfile.csv risoutput.txt
#
# Assumes you have removed the header row from the csv file,
# columns are in the same order as the labels list,
# and there are no other columns in the csv.
import csv
from sys import argv
@dsignr
dsignr / DataFrame to GML.ipynb
Last active November 23, 2022 20:09
A python script to extract data from CSV and convert it into Gephi compatible GML.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ericleasemorgan
ericleasemorgan / tika2text.sh
Last active March 27, 2017 20:47
(brain-dead) shell script using TIKA in server mode to convert a batch of files to plain text
#!/bin/bash
# tika2text.sh - given a directory, recursively extract text frome files
# Eric Lease Morgan <emorgan@nd.edu>
# (c) University of Notre Dame, distributed under a GNU Public License
# March 27, 2017 - a second cut; works with a directory
@hubgit
hubgit / pmc-open-access-eutils.txt
Last active June 3, 2019 14:26
Useful URLs for working with the PMC Open Access Subset via EUtils
Search PubMed for articles in the PMC Open Access Subset for which free full text (i.e. XML) is available:
http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=xml&term=pubmed+pmc+open+access%5Bfilter%5D+AND+free+full+text%5Bfilter%5D
Find the PMCID for an article by PMID:
http://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=pubmed&db=pmc&retmode=xml&linkname=pubmed_pmc&id=24191168
Fetch full text article XML from PMC by PMCID:
http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pmc&id=3804407
A PMC article for which the full text XML is not available:

Using Homebrew on OS X?

Want Apache Jena's command-line tools, including the incredibly useful sparql command, but can't be bothered endlessly messing with Jena's environment variables to get them to work?

Try the command below, which installs Jena via a formula made by my colleague Kevin Lyda:

brew install https://raw.github.com/lyda/homebrew/jena/Library/Formula/jena.rb

If it worked, you can now do:

Thursday 6245
Wednesday 6109
Tuesday 4985
Friday 4700
Monday 3406
Sunday 348
Saturday 308
@jimlindstrom
jimlindstrom / plot-likert.r
Created November 30, 2011 03:36
Plotting Likert-scale data with R
# Inputs
feature_names <- c("Feature 5", "Feature 4", "Feature 3", "Feature 2", "Feature 1")
num_features <- length(feature_names)
y <- array(c(10,4,1,0, 3,4,2,0, 1,2,8,1, 0,0,5,1, 1,2,5,3), dim=c(4,num_features))
# Calculate plot
num_neg_ratings <- 0
num_pos_ratings <- 0
for(i in 1:num_features) {
num_neg_ratings = max(num_neg_ratings, sum(y[1:2,i]), sum(y[3:4,i]))
@jimlindstrom
jimlindstrom / css-based-icons.sass
Created October 24, 2011 01:59
CSS3-based Checkbox and Exclamation Icons without using images
@mixin span-icon
float: left
height: 9px
line-height: 11px
font-size: 13px
font-weight: 800
margin-top: 2px
margin-bottom: 1px
margin-right: 4px
padding-bottom: 4px
@billdueber
billdueber / gist:1154163
Created August 18, 2011 14:29
OSX command-line args
1. Go to the app directory
cd /Applications/Google\ Chrome.app/Contents/MacOS/
2. Rename the app to app.orig
mv Google\ Chrome Google\ Chrome.orig
3. Create a shell script with the original name that uses the args you want
@BenWard
BenWard / pinboard-full.js
Created January 29, 2011 07:47
A smarter bookmarklet for Pinboard.in; wraps selected text in <blockquote> tags, keeps variables out of the global scope, supports filling tags from rel="tag" markup in the page, and titles from hAtom entry titles.
(function() {
// Change `silent` to true to invoke the promptless, self-closing
// version of the bookmarklet.
var silent = false;
var url = location.href;
var title = document.title;
// Look for a single hAtom entry on the page, and iff one is found, extract
// the entry-title in place of the document title: