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
;; Surely I can do better than this. | |
(defn- ^BigInteger bytes->int | |
[^bytes bytes & {:keys [little-endian] | |
:or {little-endian true}}] | |
(let [b (if little-endian (reverse bytes) bytes)] | |
(->> b | |
(cons (byte 0)) | |
(byte-array) | |
(biginteger)))) |
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
Homebrew 0.9 | |
==> Downloading http://mysql.mirrors.pair.com/Downloads/MySQL-5.1/mysql-5.1.58.tar.gz | |
Already downloaded: /Library/Caches/Homebrew/mysql51-5.1.58.tar.gz | |
/usr/bin/tar xf /Library/Caches/Homebrew/mysql51-5.1.58.tar.gz | |
==> Patching | |
/usr/bin/patch -f -p1 -i 000-homebrew.diff | |
patching file scripts/mysqld_safe.sh | |
Hunk #1 succeeded at 384 (offset 1 line). | |
patching file scripts/mysql_config.sh | |
==> ./configure --without-docs --without-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/mysql51/5.1.58 --localstatedir=/usr/local/var/mysql --sysconfdir=/usr/local/etc --with-plugins=innobase,myisam --with-extra-charsets=complex --with-ssl --without-readline --enable-assembler --enable-thread-safe-client --enable-local-infile --enable-shared --with-partition |
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
;; Just some random REPL experiments I wanted to safe in case I want to make | |
;; the mistake of building an SQL query generator. | |
(require '[clojure.string :as string]) | |
(defmulti sql-op type) | |
(defmethod sql-op Long [_] "=") | |
(defmethod sql-op String [_] "=") | |
(defmethod sql-op java.util.List [_] "in") |
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 task-web.models.db | |
(:require [clojure.tools.logging :as log] | |
[clojure.java.jdbc :as sql] | |
[clojure.string :as string])) | |
(declare scrub) | |
;;----------------------------------------------------------------------------- | |
;; UTILS | |
;;----------------------------------------------------------------------------- |
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
;; How do you undef / unintern a symbol in Clojure? | |
(ns-unmap 'namespace 'symbol) |
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
bold="\[\033[01m\]" | |
off="\[\033[0m\]" | |
blue="\[\033[0;34m\]" | |
red="\[\033[0;31m\]" | |
light_red="\[\033[1;31m\]" | |
green="\[\033[0;32m\]" | |
lgreen="\[\033[1;32m\]" | |
white="\[\033[1;37m\]" |
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 jmxican.core | |
(:require | |
[clojure.java.jmx :as jmx])) | |
;;----------------------------------------------------------------------------- | |
;; Little ditty to keep the app up and running until | |
;; we get an OS signal to shut down. | |
;;----------------------------------------------------------------------------- | |
(let [lock (promise)] |
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/sh | |
app="cipher" | |
version="0.9.2" | |
java="/usr/local/bin/java" | |
daemon="/usr/sbin/daemon" | |
app_home="/home/vagrant/apps/${app}" | |
jar="${app}-${version}-standalone.jar" |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure(2) do |config| | |
config.vm.guest = :freebsd | |
config.vm.box = "freebsd/FreeBSD-10.2-RELEASE" |
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 clj | |
(defn get-bars | |
[xml] | |
(loop [xml xml | |
bars []] | |
(if (clojure.string/blank? xml) | |
bars | |
(let [[_ bar xml2 :as r] (clojure.string/split xml #"<bar>|</bar>" 3)] | |
(if (nil? bar) |