View foo.clj
(defn nodes-to-bequeath [parent]
(xml-> (zipper/xml-zip parent)
zipper/children
#(if (get-in % [:attrs ::pm/inherit]) % nil)))
View scratch.clj
(ns scratch.scratch
(:gen-class))
(defn effect? [[k f]]
(= \! (last (name k))))
(defn if? [[k f]]
(= :if k))
(defn step [model fsm]
View gist:e2a3180ca287aa572bf347bc30673eff
#!/bin/bash
# Usage:
#
# nit-parallel [cosmos-running-instances args ...] -- [parallel args ...]
#
# e.g.
#
# ### No piped input: run command on all hosts
# nit-parallel -e test pm-nitro-test-1 -- hostname
View gist:29982c2d7c7110234809196914bb287e
$ function map () { while read -r VAR; do eval "$@"; done }
$ seq 5 | map echo '{{{$VAR}}}'
{{{1}}}
{{{2}}}
{{{3}}}
{{{4}}}
{{{5}}}
View gist:707e4df3900896ad59cfc6995cb03383
use strict; use warnings;
use XML::LibXML;
use XML::LibXML::XPathContext;
my $xml = <<'__EOI__';
<par xmlns:bar="www.bar.com"><bar:foo/></par>
__EOI__
my $parser = XML::LibXML->new();
View mysql_splitdump.sh
#!/bin/bash
####
# Split MySQL dump SQL file into one file per table
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump
# from https://gist.github.com/jasny/1608062
####
if [ $# -lt 1 ] ; then
echo "USAGE $0 DUMP_FILE"
View process_file_queue.pl
use strict;
use warnings;
use File::Spec;
my $in = 'in';
my $out = 'out';
sub process {
my ($in, $out, $callback) = @_;
opendir (my $DIR, $in) or die "Failed to open dir $in: $!";
View gist:10fdaec1d1907e758e92403933ada0c8
boot.user=> (defn and->> [f value] (doto value f))
#'boot.user/and->>
boot.user=> (defn and-> [value f] (doto value f))
#'boot.user/and->
;; use the appropriate and->(>) form for your threading macro
boot.user=> (-> 1 (and-> println))
1
1
View gist:c67922ad9d0e7611f2678937e920d762
(deftask build-deps
"Build a deps JAR."
[d dir PATH #{str} "the set of directories to write to (target)."]
(set-env! :resource-paths #{}
:source-paths #{})
(task-options! jar #(assoc % :file "epg-ingester-deps.jar" :main nil))
(let [dir (if (seq dir) dir #{"target"})]
(comp (test) (aot) (pom) (uber) (jar) (target :dir dir))))
View curry.clj
(defmacro curry [fname fixed-args & body]
(let [arg-count (count fixed-args)]
`(defn ~fname [& ~'args]
(cond
(< (count ~'args) ~arg-count)
(apply partial (concat [~fname] ~'args))
:else
(let [~fixed-args ~'args]
~@body)))))