Skip to content

Instantly share code, notes, and snippets.

View elliott-beach's full-sized avatar

Elliott Beach elliott-beach

  • Epic
  • Minnesota
View GitHub Profile
@elliott-beach
elliott-beach / heap.py
Created February 8, 2017 15:28 — forked from showell/heap.py
heapsort in Python
def swap(a, i, j):
a[i], a[j] = a[j], a[i]
def is_heap(a):
n = 0
m = 0
while True:
for i in [0, 1]:
m += 1
if m >= len(a):
@elliott-beach
elliott-beach / heap.py
Last active February 8, 2017 16:06 — forked from showell/heap.py
heapsort in Python
def swap(a, i, j):
a[i], a[j] = a[j], a[i]
def heapify(a, n, max):
while True:
biggest = n
c1 = 2*n + 1
c2 = c1 + 1
for c in [c1, c2]:
if c < max and a[c] > a[biggest]:
@elliott-beach
elliott-beach / tmux_local_install.sh
Created June 14, 2016 19:29 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@elliott-beach
elliott-beach / tcget.py
Created February 7, 2016 00:29 — forked from cou929/tcget.py
Fetch TopCoder problem statement, test cases and expected result of system test. And save these data to file.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
tcget.py
Kosei Moriyama <cou929@gmail.com>
'''
import BeautifulSoup