Skip to content

Instantly share code, notes, and snippets.

View onriv's full-sized avatar
🎯
Focusing

onriv onriv

🎯
Focusing
View GitHub Profile
@onriv
onriv / markup.py
Created January 8, 2014 13:31
python:textconvert:markup.py
import sys, re
from handlers import *
from util import *
from rules import *
class Parser:
"""
A Parser reads a text file, applying rules and controlling a
handler.
"""
@onriv
onriv / rules.py
Created January 8, 2014 13:30
python:textcoonvert:rules.py
class Rule:
"""
Base class for all rules.
"""
def action(self, block, handler):
handler.start(self.type)
handler.feed(block)
handler.end(self.type)
return True
@onriv
onriv / oarSimFileGen.py
Created December 3, 2013 17:10
Python:oarSimFileGen.py
#!/usr/bin/python
import os, sys, shutil, re
source_file = open(sys.argv[1])
source_name = sys.argv[1].rstrip(".egsinp")
dst_file1_name = source_name + "_colli50mm.egsinp"
dst_file2_name = source_name + "_colli40mm.egsinp"
dst_file3_name = source_name + "_colli30mm.egsinp"
dst_file4_name = source_name + "_colli25mm.egsinp"
@onriv
onriv / readdosedata.py
Created November 14, 2013 16:15
python:test.py
#!/usr/bin/python
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import sys,getopt
#class dosedata: