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
#!/bin/env bb | |
(let [cgb #(->> % (cons "http://169.254.169.254/latest") (str/join "/") curl/get :body) | |
try-json #(try (json/parse-string %) (catch Exception _ %)) | |
dir? #(str/ends-with? (last %) "/") | |
paths (fn [p] (->> (cgb p) | |
str/split-lines | |
(map #(->> (str/split % #"=") first (conj p))))) | |
trimlslash #(str/replace % #"/$" "")] | |
(json/generate-stream |
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 hw1 (:refer-clojure :exclude [eval])) | |
(defrecord StringLit [s]) | |
(defrecord Concat [l r]) | |
(defrecord RestAfter [l r]) | |
(defn parse [sexp] | |
(cond (symbol? sexp) (StringLit. (str sexp)) | |
(sequential? sexp) | |
(case (second sexp) |
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
;;;; Copyright (c) 2007 Martin Giese. All rights reserved. | |
;;;; | |
;;;; Author: Martin Giese | |
;;;; Author: Dimitry Gashinsky | |
;;;; Id: 295eb73b-9e95-46a6-9cce-366436f9712f | |
;;;; | |
;;;; FIGlet definitions for Emacs. | |
;;;; | |
;;;; Use this to separate sections in TeX files, Program source, etc. | |
;;;; |
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
(defn startparse-tagsoup [s ch] | |
(.parse (doto (org.ccil.cowan.tagsoup.Parser.) | |
(.setContentHandler ch)) | |
(org.xml.sax.InputSource. s))) | |
(xml/parse "http://bla" startparse-tagsoup) |
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
(defun slime-repl-emit-result (string &optional bol) | |
;; insert STRING and mark it as evaluation result | |
(with-current-buffer (slime-output-buffer) | |
(save-excursion | |
(slime-save-marker slime-output-start | |
(slime-save-marker slime-output-end | |
(goto-char slime-repl-input-start-mark) | |
(when (and bol (not (bolp))) (insert-before-markers "\n")) | |
(slime-propertize-region `(face slime-repl-result-face | |
rear-nonsticky (face)) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>CFBundleDisplayName</key> | |
<string>Conkeror</string> | |
<key>CFBundleIdentifier</key> | |
<string>org.mozdev.conkeror</string> |
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 bash | |
# # Copyright (c) 2009 Dimitry Gashinsky. No rights reserved. | |
# # | |
# # Author: Dimitry Gashinsky (dimitry :at gashinsky :dot com) | |
# # Id: 2C189717-816D-49E4-B244-1CBEFF623889 | |
set -eux | |
cd ~/src/xul | |
xulrunner-bin --install-app conkeror | |
cp -f conkeror/Info.plist /Applications/conkeror.mozdev.org/conkeror.app/Contents/ |
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
package com.polarsparc.clojure; | |
import java.util.Random; | |
import clojure.lang.RT; | |
import clojure.lang.Var; | |
public class CompiledFilter { | |
private static int[] nums; | |
private static Var filterEvenGt500; |
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 filters) | |
(defn filter-even-gt-500 [num] | |
(and (> num 500) (even? num))) | |
(defn filter-odd-gt-500 [num] | |
(and (> num 500) (odd? num))) | |
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 l-cache) | |
(set! clojure.core/*warn-on-reflection* true) | |
(defmacro with-time | |
"Evaluates expr and returns a vector of expression value and the | |
time it took to evaluate it in milliseconds." | |
[expr] | |
`(let [start# (System/nanoTime) | |
ret# ~expr |
NewerOlder