Skip to content

Instantly share code, notes, and snippets.

;; Open the file in the current buffer in another git worktree
(defun my/magit-open-file-in-worktree ()
(interactive)
(flet ((worktrees ()
(mapcar
(lambda (x) (cons (nth 3 x) (nth 0 x)))
(magit-list-worktrees)))
(open-buffer (repo-path)
(let* ((file-path (file-relative-name buffer-file-name (magit-toplevel)))
(filename (concat (file-name-as-directory repo-path) file-path)))
function download(text, name, type) {
var a = document.createElement("a");
document.body.appendChild(a)
var file = new Blob([text], {type: type});
a.href = URL.createObjectURL(file);
a.download = name;
a.click();
}
function getMessage(elt) {
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import java.util.TreeSet;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLDataFactory;
@benozol
benozol / TestCase.java
Last active December 8, 2016 18:25
Test case for OWLKnowledgeExplorerReasoner.getObjectLabel
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.reasoner.ConsoleProgressMonitor;
import org.semanticweb.owlapi.reasoner.InferenceType;
import org.semanticweb.owlapi.reasoner.OWLReasonerConfiguration;

Keybase proof

I hereby claim:

  • I am benozol on github.
  • I am benozol (https://keybase.io/benozol) on keybase.
  • I have a public key ASCYlT0ZPlEASF08IPU-tw3QCZEl8rcqcm8MUBkFoHjBeQo

To claim this, I am signing this object:

@benozol
benozol / umls-to-peregrine.py
Last active August 11, 2016 13:22
Convert UMLS Metathesaurus files to a Peregrine ontology
#!/usr/bin/env python3
# (C) 2016 Benedikt Becker, Erasmus MC, Rotterdam
from collections import namedtuple, defaultdict
import argparse
import pickle
import gzip
import pandas as pd
import sys
import shlex
@benozol
benozol / redo.py
Last active July 27, 2016 07:59
A thin Python wrapper for https://github.com/mildred/redo.git
from pathlib import Path
import os
import sys
import logging
"""
A thin wrapper of redo.
=======================
- Simple declaration of and access to dependencies
@benozol
benozol / eliom-switch-client-server.el
Created September 25, 2012 15:38
Eliom development: Switch between server and client files
(setq
server-regexp "\\`.*/eliom/src/\\(server\\)/"
client-regexp "\\`.*/eliom/src/\\(client\\)/")
(defun switch-client-server-file-name (file-name)
(let* ((client-name (replace-regexp-in-string server-regexp "client" file-name nil nil 1))
(server-name (replace-regexp-in-string client-regexp "server" file-name nil nil 1)))
(cond
((not (equal client-name file-name)) (list client-name 'server))
#!/usr/bin/python
# Monitors file changes and runs programs on them.
# Needs pyinotifyx.
import os, sys, subprocess
from inotifyx import init, add_watch, IN_CLOSE_WRITE, get_events, rm_watch
help_text="""\
This program monitors some files and runs some commands if one is modified.
For example, to interactively view the pdf of a latex file, start: