Skip to content

Instantly share code, notes, and snippets.

View andrewsosa's full-sized avatar

Andrew Sosa andrewsosa

View GitHub Profile
@andrewsosa
andrewsosa / .zshrc
Created April 22, 2017 15:40
zshell config
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/andrew/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="materialshell-oceanic"
@andrewsosa
andrewsosa / mergesort.py
Last active March 6, 2017 17:23
Minimalistic Merge sort in Python
def select(left, right):
"""Choose the minimum front from left and right, but handle empty lists."""
return left.pop(0) if (len(left) > 0 and len(right) is 0) or (len(left) > 0 and left[0] < right[0]) else right.pop(0)
def merge(left, right):
"""Conquer: Merge together the selected (min) front of left and right."""
return [select(left,right) for i in range((len(left) + len(right)))]
def sort(l):
"""Divide: Recursive call to split input list into managable sublists."""