Skip to content

Instantly share code, notes, and snippets.

View zedr's full-sized avatar
👾

Rigel Di Scala zedr

👾
View GitHub Profile

Keybase proof

I hereby claim:

  • I am zedr on github.
  • I am rdiscala (https://keybase.io/rdiscala) on keybase.
  • I have a public key whose fingerprint is 5357 3892 0117 DAB1 FE13 2778 7F60 DF87 BBC5 0EEB

To claim this, I am signing this object:

@zedr
zedr / fib_micro_service.py
Created September 26, 2017 08:44 — forked from aalhour/fib_micro_service.py
Fibonacci microservice using Python & Tornado.
import tornado.web
import tornado.ioloop
from tornado.options import define, options
define('port', default=45000, help='try running on a given port', type=int)
def fib():
a, b = 1, 1
while True:
yield a
:nnoremap <CR> :!make && ./main<CR>
"""
Slack chat-bot Lambda handler.
"""
import os
import logging
import urllib
# Grab the Bot OAuth token from the environment.
BOT_TOKEN = os.environ["BOT_TOKEN"]
@zedr
zedr / link.py
Created December 15, 2016 18:40
Algorithm: linked list reversion
@zedr
zedr / merge_sort.py
Created December 11, 2016 13:43
Algorithm: merge sort
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def merge(arr1, arr2):
idx = ldx = 0
l1 = len(arr1)
l2 = len(arr2)
tmp = []
while idx < l1 and ldx < l2:
@zedr
zedr / insertion_sort.py
Last active December 11, 2016 13:46
Algorithm: insertion sort
# Complexity: O(n^2)
def sort(arr):
l = len(arr)
if l > 1:
for ldx in range(l):
idx = ldx - 1
key = arr[ldx]
while idx > -1 and arr[idx] > key:
arr[idx + 1] = arr[idx]
@zedr
zedr / zeroes.py
Created December 9, 2016 22:34
Algorithm: zeroes on the right, non-zeroes on left
# Given an list of random numbers, push all the zeroes to the end of the list.
# For example, if the given list is [1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0],
# it should be changed to [1, 9, 8, 4, 2, 7, 6, 0, 0, 0, 0].
# Time complexity should be O(n).
def order(arr):
idx = 0
ldx = len(arr) - 1
while idx < ldx:
a = arr[idx]