This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Foundation import * | |
from ScriptingBridge import * | |
iTunes = SBApplication.applicationWithBundleIdentifier_( | |
"com.apple.iTunes") | |
years = {} | |
for track in iTunes.currentPlaylist().tracks(): | |
if not track.year() in years: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* gist formatting */ | |
.line { | |
background-color: #f1fafb; | |
} | |
.gist-highlight { | |
border-left: 3ex solid #eee; | |
position: relative; | |
} | |
.gist-highlight pre { | |
counter-reset: linenumbers; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"enable syntax highlighting | |
syntax enable: | |
"set color scheme | |
set background=dark | |
"tab settings | |
set expandtab | |
set tabstop=4 | |
set shiftwidth=4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bashrc | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
# User specific aliases and functions | |
export PS1="\n\[\e[32m\]\u@\h \e[37m\t \[\e[33m\]\w\[\e[0m\]\$(__git_ps1)\n\$ " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bash_profile | |
# Get the aliases and functions | |
if [ -f ~/.bashrc ]; then | |
. ~/.bashrc | |
fi | |
# User specific environment and startup programs | |
PATH=$PATH:$HOME/bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import curses | |
from itertools import product, islice, cycle | |
import random | |
import time | |
# cycling iterator of a cell's eight neigbors | |
neighbors = cycle(filter(lambda x: x!=(0,0), product(range(-1,2), repeat=2))) | |
def iterate(board, board_size): | |
"""Given a board state generate the next generation and return it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import timeit | |
from shakespeare import LETTERS, WORDS | |
if __name__ == '__main__': | |
# dict | |
t = timeit.Timer(stmt=""" | |
counter = dict() | |
for k in LETTERS: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
red_wine$volatile.acidity.cat <- | |
cut(red_wine$volatile.acidity, | |
breaks = quantile(red_wine$volatile.acidity, | |
probs = c(0, 0.25, 0.5, 0.75, 1.0))) | |
x_title = "Alcohol (percentage by volume)" | |
y_title = "Quality\n(0: very bad -> 10: very excellent)" | |
color_title = expression(paste("Volatile Acidity (", g / dm^{3}, ")")) | |
# Create label array for color legend. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import random | |
def binary_search(target, epsilon): | |
guess = 1.0 | |
bottom = 1.0 | |
top = float("inf") | |
steps = 0 | |
while abs(target-guess)>epsilon: |
OlderNewer