This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lxml import etree | |
radlex_tree = etree.parse('Radlex3.13.1.owl').getroot() | |
# Get all the term names of the Ontology, in a list. | |
all_terms = radlex_tree.xpath('//x:Preferred_name/text()', | |
namespaces={'x': radlex_tree.nsmap[None]}) | |
with open('radlex_all_terms_names.txt', 'w') as f: | |
for term in all_terms: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pattern.en import singularize | |
from nltk import word_tokenize | |
def singularize_all_words(text): | |
tokenized_text = word_tokenize(text) | |
tokenized_singularized_text = map(singularize, tokenized_text) | |
singularized_text = ' '.join(tokenized_singularized_text) | |
return singularized_text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import random | |
def luhn_checksum(n): | |
"""Calculates Luhn's Checksum of a number. n must be a string. | |
Check Wikipedia to understand the algorithm.""" | |
even = 0 | |
odd = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import os | |
import re | |
import nltk.data | |
"""Converts annotations output from Noble Coder (http://noble-tools.dbmi.pitt.edu/) to | |
WebAnno TSV 2 format (https://webanno.github.io/webanno/releases/3.0.1/docs/user-guide.html#sect_webannotsv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
input_file_name = 'hp.obo' | |
output_file_name = 'hpo.txt' | |
# Read the whole .obo file into a string | |
with open(input_file_name) as f: | |
obo_string = f.read() | |
# This will include all entity names, including main names and synonyms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install with: | |
# ln -s ../../pre-commit.sh .git/hooks/pre-commit | |
# Inspired by: | |
# https://gist.github.com/arnobroekhof/9454645 | |
function pop_stash { | |
STASHES=($(git stash list)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import subprocess | |
from time import sleep, time | |
save_folder = "/home/lcampos/Dropbox/BetterConversationsRecordings" | |
speakers_monitor_stream = "alsa_output.pci-0000_00_1f.3.analog-stereo.monitor" | |
class Recording: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Am I talking about me again? | |
// @namespace | |
// @version 0.1 | |
// @description Find references to myself in messaging web apps | |
// @author | |
// @match | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Replace here | |
servers=(server1 server2 server3) | |
for server in "${servers[@]}"; do | |
x-terminal-emulator --new-tab -e "ssh $server" | |
done |