Skip to content

Instantly share code, notes, and snippets.

View jcbsv's full-sized avatar

Jacob Svensson jcbsv

View GitHub Profile
import json
from xml.etree import ElementTree
tree = ElementTree.parse('raml20.xml')
ns = {'ns': 'raml20.xsd'}
nsP, nsList, nsItem = ('{%s}%s' % (ns['ns'], i) for i in ('p', 'list', 'item'))
@jcbsv
jcbsv / matlab_substitutes.jl
Last active December 24, 2020 20:15
Somewhat Matlab compatible Julia functions: decimate and cheby1
using DSP
function cheby1(n, r, wp)
# Chebyshev Type I digital filter design.
#
# b, a = cheby1(n, r, wp)
#
# Designs an nth order lowpass digital Chebyshev filter with
# R decibels of peak-to-peak ripple in the passband.
@jcbsv
jcbsv / pattern_match.py
Last active August 29, 2015 14:16
Finding a pattern in a list
"""Finding a pattern in a list
A solution to the Stack Overflow question:
http://stackoverflow.com/questions/6656310/finding-patterns-in-a-list
"""
import itertools
def pattern_match(pattern, sequence):