Skip to content

Instantly share code, notes, and snippets.

View goldsmith's full-sized avatar

Jon Goldsmith goldsmith

View GitHub Profile
@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 5, 2024 22:32
Swift Concurrency Manifesto
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)
@carymrobbins
carymrobbins / raw_as_qs.py
Last active March 25, 2022 12:21
Django - convert RawQuerySet to QuerySet
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
"""
@naiquevin
naiquevin / octo2pelican.py
Created February 17, 2013 17:21
A quick script for converting octopress posts (markdown source files) to pelican posts (markdown again but slightly different)
#!/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'
@telent
telent / core.clj
Created March 3, 2012 22:03
Audio (mp3/flac/etc) tag support for Clojure via JAudiotagger
(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]]