Skip to content

Instantly share code, notes, and snippets.

# *sh command shortcuts
alias c='clear'
alias batt='pmset -g batt'
alias sand='cd ~/code/sandbox'
# specific program shortcuts
alias gl='git log --graph --pretty=oneline'
import os, io
def main():
f = open('pyramid.txt', 'r')
root = {}
for l in f.readlines()
l = l.split()
if not root:
l
75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
@jfo
jfo / .aliases
Created February 12, 2014 16:59
alias daynote="vim ~/code/hsnotes/$( date '+%d-%m_' )notes.md"
@jfo
jfo / list1.py
Created February 14, 2014 18:01
# yuri's solution
def sort_last(tuples):
return sorted(tuples, key=lambda t: t[-1])
# my dumb solution
def sort_lastt(tuples):
# +++your code here+++
diction = {}
@jfo
jfo / board.py
Created February 23, 2014 06:39
import pdb
import lxml.html
import time
from urllib2 import urlopen
import os
class Cell:
def __init__(self, value):
self.value = int(value)
self.possibilities = set([x for x in range(1,10)])
def fetch_new_puzzle(difficulty):
"""Get a new puzzle from the online source.
Difficulties are from 1 to 5 maybe? Integers.
Boards are indexed x and y, where x is the row
number and y is the column number.
"""
page_text = urlopen("http://www.free-sudoku.com/sudoku.php?mode=%s" %
difficulty ).read()
tree = html.fromstring(page_text)
adjsfioadjsi
(ns enclojure.equal)
(defn lower [note]
(if (< note 20.0)
note
(lower (/ note 2))))
(defn equaltemp [a acc]
(if (> a 20000.0)
acc
require 'pry'
g = [[1, 2],
[1, 4],
[2, 1],
[2, 3],
[2, 5],
[3, 2],
[3, 11],
[4, 1],
[4, 5],