Skip to content

Instantly share code, notes, and snippets.

@aparrish
aparrish / understanding-word-vectors.ipynb
Last active Apr 13, 2021
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View understanding-word-vectors.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View wos_extract.md

Web of Science parser

Download dependencies

import xml.etree.cElementTree as ET
from lxml import etree
from itertools import chain
import pandas as pd
@ruebot
ruebot / config.ttl
Created Apr 27, 2016
Fuseki Configuration with inference
View config.ttl
@prefix : <#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
[] rdf:type fuseki:Server ;
fuseki:services (
<#fedoraService>
@oglops
oglops / yaml_OrderedDict.py
Last active Oct 11, 2020
write to and load from yaml file with OrderedDict
View yaml_OrderedDict.py
#!/usr/bin/env python
try:
# for python newer than 2.7
from collections import OrderedDict
except ImportError:
# use backport from pypi
from ordereddict import OrderedDict
import yaml
@tasdikrahman
tasdikrahman / python_tests_dir_structure.md
Last active Apr 6, 2021
Typical Directory structure for python tests
View python_tests_dir_structure.md

A Typical directory structure for running tests using unittest

Ref : stackoverflow

The best solution in my opinion is to use the unittest [command line interface][1] which will add the directory to the sys.path so you don't have to (done in the TestLoader class).

For example for a directory structure like this:

new_project
├── antigravity.py
@edsu
edsu / justin-lingvoj.ttl
Last active Sep 11, 2015
An rdfs hack to infer a language competency based on more specific lingvoj language competencies. It also would allow hasCompetency to be used when the specific ability is not known.
View justin-lingvoj.ttl
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix lingvoj: <http://www.lingvoj.org/ontology#> .
:hasCompetency
a owl:ObjectProperty ;
rdfs:label "basic competency in a language"@en ;
rdfs:range :Lingvo ;
rdfs:domain foaf:Person .
lingvoj:basicUnderstanding rdfs:subPropertyOf :hasCompetency .
@ervinb
ervinb / maven-333.sh
Created Jul 1, 2015
Install Maven 3.3.3 on Ubuntu 14.04
View maven-333.sh
#!/bin/sh
sudo apt-get purge -y maven
if ! [ -e .semaphore-cache/apache-maven-3.3.3-bin.tar.gz ]; then (cd .semaphore-cache; curl -OL http://mirror.olnevhost.net/pub/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz); fi
sudo tar -zxf .semaphore-cache/apache-maven-3.3.3-bin.tar.gz -C /usr/local/
sudo ln -s /usr/local/apache-maven-3.3.3/bin/mvn /usr/bin/mvn
echo "Maven is on version `mvn -v`"
@lmullen
lmullen / Makefile
Last active Nov 14, 2020
PDF slides and handouts using Pandoc and Beamer
View Makefile
SLIDES := $(patsubst %.md,%.md.slides.pdf,$(wildcard *.md))
HANDOUTS := $(patsubst %.md,%.md.handout.pdf,$(wildcard *.md))
all : $(SLIDES) $(HANDOUTS)
%.md.slides.pdf : %.md
pandoc $^ -t beamer --slide-level 2 -o $@
%.md.handout.pdf : %.md
pandoc $^ -t beamer --slide-level 2 -V handout -o $@
View gist:7691723
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
View doi-prefix-publishers.csv
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