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
# Boyer Moore String Search implementation in Python | |
# Ameer Ayoub <ameer.ayoub@gmail.com> | |
# Generate the Bad Character Skip List | |
def generateBadCharShift(term): | |
skipList = {} | |
for i in range(0, len(term)-1): | |
skipList[term[i]] = len(term)-i-1 | |
return skipList |
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
#!/bin/bash | |
# Functions ============================================== | |
# return 1 if global command line program installed, else 0 | |
# example | |
# echo "node: $(program_is_installed node)" | |
function program_is_installed { | |
# set to 1 initially | |
local return_=1 |
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
import json | |
def combine_json(): | |
with open('j1.json') as file: | |
d1 = json.loads(file.read()) | |
with open('j2.json') as file: | |
d2 = json.loads(file.read()) | |
result = combine_dict(d1,d2) | |
j3 = json.dumps(result) | |
return j3 |