Author: Chris Lattner
This file contains 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 wikipedia, sys | |
def AStar(start, goal): | |
closedset = [] | |
openset = [trypage(link) for link in start.links] | |
navigated = {} | |
g_score = lambda start: 0 | |
f_score = lambda start: g_score(start) + heuristic_cost(start, goal) |
This file contains 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 django.db import connection, models | |
class MyManager(Manager): | |
def raw_as_qs(self, raw_query, params=()): | |
"""Execute a raw query and return a QuerySet. The first column in the | |
result set must be the id field for the model. | |
:type raw_query: str | unicode | |
:type params: tuple[T] | dict[str | unicode, T] | |
:rtype: django.db.models.query.QuerySet | |
""" |
This file contains 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
#!/usr/bin/env python | |
import os | |
import yaml | |
import datetime | |
from collections import OrderedDict | |
__doc__ = 'A quick script for converting octopress posts (markdown source files) to pelican posts' | |
This file contains 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
(ns onelouder.core | |
(:import [org.jaudiotagger.audio AudioFileIO] | |
[org.jaudiotagger.tag FieldKey])) | |
(defn tags [file] | |
(let [fields (apply conj {} (map (fn [n] [(keyword (. (. n toString) toLowerCase)) n]) (. FieldKey values))) | |
tag (. file (getTag))] | |
(apply conj {} | |
(filter (fn [[name val]] (and val (not (empty? val)))) | |
(map (fn [[name val]] |