View reformat_csv.py
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
''' | |
A simple python script to reduce or reformat a csv file, producing a | |
csv with a specific sub-set of columns, stripping out any undesired | |
characters from the individual row values. | |
''' | |
import csv |
View simple_kv_service.py
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 | |
""" | |
simple_kv_service.py | |
A simple example of a key-value (kv) storage and lookup service, | |
accessible over http/rest: | |
http://[host]:[port]/set?somekey=somevalue => assigns "somevalue" to "somekey" | |
http://[host]:[port]/get?key=somekey => looks up "somekey" and returns its value, if it exists |
View .bash_aliases
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
alias pdftk='$HOME/.pdftk.sh' |
View breadth_first_search.py
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 python | |
""" | |
A breadth-first search implementation from: | |
"MIT Open CourseWare: Introduction to Algorithms" | |
Lecture 13: Breadth-First Search | |
https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/lecture-videos/lecture-13-breadth-first-search-bfs/ |
View depth_first_search.py
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 python | |
""" | |
An iterative implementation of depth-first search from: | |
"Python Algorithms: Mastering Basic Algorithms in the Python Language" | |
by Magnus Lie Hetland | |
ISBN: 9781484200551 |
View sliding_window.py
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 python | |
""" | |
An implementation of the "sliding window" technique to find shortest matching subarrays, inspired by: | |
https://leetcode.com/problems/find-all-anagrams-in-a-string/discuss/92007/sliding-window-algorithm-template-to-solve-all-the-leetcode-substring-search-problem | |
""" | |
from sys import maxint |
View bellman_ford.py
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 python | |
""" | |
An implementation of the Bellman-Form algorithm from: | |
"Python Algorithms: Mastering Basic Algorithms in the Python Language" | |
by Magnus Lie Hetland | |
ISBN: 9781484200551 |
View breadth_first_search.py
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 python | |
""" | |
A breadth-first search implementation from: | |
"Python Algorithms: Mastering Basic Algorithms in the Python Language" | |
by Magnus Lie Hetland | |
ISBN: 9781484200551 |
View quicksort.py
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 python | |
""" | |
An implementation in python, inspired by the version in "Learn You | |
a Haskell for Great Good!" | |
(http://learnyouahaskell.com/recursion#quick-sort) | |
""" | |
def quicksort (a): |
View mergesort.py
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 python | |
""" | |
An implementation in python, inspired by the haskell version via | |
Cormen | |
(https://github.com/dpapathanasiou/algorithms-unlocked-haskell/blob/master/algorithms-for-sorting-and-searching/MergeSort.hs) | |
""" | |
def merge (a, b, c=[]): |
NewerOlder