A ZSH theme optimized for people who use:
- Solarized
- Git
- Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
For Mac users, I highly recommend iTerm 2 + Solarized Dark
(defn replace-if-underscore [element val] | |
(if (= element '_) | |
val | |
element)) | |
(defn replace-underscores [form val] | |
(map #(replace-if-underscore % val) form)) | |
(defn convert-forms [val [next-form & other-forms]] | |
(if (nil? next-form) |
# install dependencies | |
sudo apt-get install libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm | |
# clone cpuminer | |
git clone https://github.com/pooler/cpuminer.git | |
# compile | |
cd cpuminer | |
./autogen.sh | |
./configure CFLAGS="-O3" |
;; LTSV (Labeled Tab-separated Values) parser by Clojure | |
(use '[clojure.string :only [split]]) | |
(defn ltsv-parse-line | |
"Parses one LTSV line. Returns a map." | |
[^String line] | |
(reduce (fn [r s] (let [[k v] (split s #":" 2)] (assoc r k v))) | |
{} (split line #"\t") )) |
(:use [ring.util.codec :only [url-encode]]) | |
(defn- make-query-string [m] | |
(->> (for [[k v] m] | |
(str (url-encode k) "=" (url-encode (str v)))) | |
(interpose "&") | |
(apply str))) | |
(defn make-ga-url [utmp ip] | |
(let [gif-url "http://www.google-analytics.com/__utm.gif?" |
(ns scratchpad.core | |
(:require [monger.core :as mg] | |
[monger.collection :as mc] | |
[monger.query :as mq])) | |
(def local-mongodb | |
(.getDB (mg/connect-via-uri! "mongodb://127.0.0.1:27017/local") "local")) | |
{-# LANGUAGE OverloadedStrings #-} | |
import Data.Conduit | |
import Data.Conduit.Network | |
import Data.Conduit.Text (encode, decode, utf8) | |
import qualified Data.Conduit.List as CL | |
import qualified Data.Conduit.Binary as CB | |
import Data.Text (toUpper) | |
import qualified Data.ByteString.Char8 as S8 |
Fabric is a deployment management framework written in Python which makes remotely managing multiple servers incredibly easy. If you've ever had to issue a change to a group servers, this should look pretty familiar:
for s in $(cat servers.txt); do ssh $s service httpd graceful; done
Fabric improves on this process by providing a suite of functions to run commands on the servers, as well as a number of other features which just aren't possible in a simple for loop. While a working knowledge of Python is helpful when using Fabric, it certainly isn't necessary. This tutorial will cover the steps necessary to get started with the framework and introduce how it can be used to improve on administering groups of servers.
(ns aws.s3 | |
(:refer-clojure :exclude [get]) | |
(:use [clojure.walk :only (keywordize-keys stringify-keys)] | |
[clojure.contrib.def :only (defonce-)] | |
[clojure.contrib.json :only (read-json write-json)]) | |
(:import [java.io PrintWriter InputStreamReader ByteArrayInputStream ByteArrayOutputStream] | |
[java.util.zip GZIPInputStream GZIPOutputStream] | |
[com.google.common.base Charsets] | |
[com.amazonaws.services.s3 AmazonS3Client] | |
[com.amazonaws.services.s3.model Region CreateBucketRequest ObjectMetadata |