Skip to content

Instantly share code, notes, and snippets.

Nathan Baker sobolevnrm

View GitHub Profile
@sobolevnrm
sobolevnrm / ris.py
Created Aug 21, 2016
A very simple RIS file parser
View ris.py
""" Process RIS format following the standard at",
http://referencemanager.com/sites/rm/files/m/direct_export_ris.pdf """
import re
ALLOWED_TAGS = {"TY" : "Record start",
"ER" : "Record end",
"A2" : "Secondary author",
"A3" : "Tertiary Author",
"A4" : "Subsidiary Author",
"AB" : "Abstract",
@sobolevnrm
sobolevnrm / pdb-query.xml
Created Dec 23, 2015
Find PDB structures which are good candidates for pKa calculations.
View pdb-query.xml
<orgPdbCompositeQuery version="1.0">
<resultCount>45981</resultCount>
<queryId>A646F4B6</queryId>
<queryRefinement>
<queryRefinementLevel>0</queryRefinementLevel>
<orgPdbQuery>
<version>head</version>
<queryType>org.pdb.query.simple.NumberOfChainsQuery</queryType>
<description>Number of Chains Search : Min Number of Chains=1 Max Number of Chains=1</description>
<queryId>14430407</queryId>
@sobolevnrm
sobolevnrm / generic_ctor.py
Created Nov 24, 2015
I am trying to create the object of a class when I have only the string of the class name avoiding a bunch of conditionals
View generic_ctor.py
# I have lots of classes with very similar constructors. I'd like to avoid a huge if elseif ... statement
# This works when all classes are specified in the global scope but breaks across modules -- it also doesn't seem very safe
class Foo:
def __init__(self):
self.bar = "FOOBAR"
class_name = "Foo"
ctor = globals()[class_name]
obj = ctor()
print(obj.bar)
View Omnifocus2RTM.py
"""
Transform exported data from OmniFocus into RememberTheMilk Smart Add file. Fields from
OmniFocus are expected to be:
Task ID,Type,Name,Status,Project,Context,Start Date,Due Date,Completion Date,Duration,Flagged,Notes
"""
import csv
import sys
from datetime import datetime
@sobolevnrm
sobolevnrm / Things extractor.scpt
Created Oct 25, 2015
Applescript to extract tasks from Things.app
View Things extractor.scpt
tell application "Things"
set todo_output to "
"
repeat with the_list in lists
set list_name to name of the_list
set list_todos to to dos of the_list
repeat with the_todo in list_todos
if status of the_todo is open then
set todo_name to name of the_todo
set todo_due to due date of the_todo
You can’t perform that action at this time.