Skip to content

Instantly share code, notes, and snippets.

View aulb's full-sized avatar

albert aulb

  • United States
View GitHub Profile
@aulb
aulb / index.html
Last active October 15, 2018 04:14
style.css
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Home</title>
<link rel="shortcut icon" type="image/png" href="icons/favicon_01.png" />
<link rel="stylesheet" type="text/css" href="reset.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
findMin(arr, 0, len(findMin) -1)
def findMin(arr, low, high):
# This condition is needed to handle the case when array is not
# rotated at all
if high < low:
return 0
# If there is only one element left
if high == low:
# "Binary search the pivot"
def find_pivot(array, low, high):
# If low becomes higher not found
if (high < low): return -1
if (high == low): return low
mid = (low + high) // 2
# If at the boundary [4,5,1,2,3] if mid = 2 and high = 4, arr[m] is not > arr[m + 1]
# check if 1 > 2: goal to find 5 > 1
# mid < high so that mid + 1 is valid
@aulb
aulb / lcd.py
Created October 12, 2017 01:42
Making LCD
lcd_numbers = {
'0': [' {under} ', '{pipe}{space}{pipe}', '{pipe}{under}{pipe}'],
'1': [' {space} ', ' {space}{pipe}', ' {space}{pipe}'],
'2': [' {under} ', ' {under}{pipe}', '{pipe}{under} '],
'3': [' {under} ', ' {under}{pipe}', ' {under}{pipe}'],
'4': [' {space} ', '{pipe}{under}{pipe}', ' {space}{pipe}'],
'5': [' {under} ', '{pipe}{under} ', ' {under}{pipe}'],
'6': [' {under} ', '{pipe}{under} ', '{pipe}{under}{pipe}'],
'7': [' {under} ', ' {space}{pipe}', ' {space}{pipe}'],
'8': [' {under} ', '{pipe}{under}{pipe}', '{pipe}{under}{pipe}'],
exports.findKanji = (req, res) => {
const key = req.params.kanji;
redisClient.get(key, function(error, result) {
// If not found in redis, check Mongo
if (result === null || error) {
MongoClient.connect(url, function(mongoError, db) {
// If can't connect throw 404
if (mongoError) {
res.status(404).send({});