Skip to content

Instantly share code, notes, and snippets.

View devth's full-sized avatar
Hacking on @yetibot

Trevor Hartman devth

Hacking on @yetibot
View GitHub Profile
@devth
devth / .zshrc
Created June 27, 2012 16:43
zshrc git aliases
# Git Aliases
alias gitr='cd `git root`'
alias gpr='git pull --rebase && git --no-pager hist @{1}.. && echo'
alias gpom='git push origin master'
alias gs="git status"
alias gp="echo 'Pushing commits:' && git --no-pager hist HEAD@{upstream}.. && echo '' && git push"
alias gd="git diff"
alias gds="git diff --shortstat"
alias gl="git log"
alias gk="gitx"
@devth
devth / fade_animation.cs
Created October 18, 2010 17:00
Fade animation in C# / WPF
DoubleAnimation animation = new DoubleAnimation();
animation.To = 0;
//animation.From = 1;
animation.Duration = TimeSpan.FromMilliseconds(ANIMATION_SPEED);
animation.EasingFunction = new QuadraticEase();
Storyboard sb = new Storyboard();
sb.Children.Add(animation);
c.Opacity = 1;
118
121
123
125
134
132
137
135
136
137
(defn xkcd-cmd
"xkcd # fetch current xkcd comic"
{:yb/cat #{:fun :img}}
[_]
((juxt :title :img :alt) (get-json endpoint)))
(defn xkcd-idx-cmd
"xkcd <index> # fetch xkcd number <index>"
{:yb/cat #{:fun :img}}
[{index :match}]

Yetibot usage fundamentals

Instead of working through Yetibot's primitives and its many individual capabilities we'll start with a non trivial expression that's made up of several levels of nested aliases composed of piped commands. This will better illustrate how such primitives can be combined into something useful fun.

!yetishould
@devth
devth / es_query.sh
Last active September 11, 2017 18:21
es_query() {
port="${port?$port must be set}"
pass="${pass?$pass must be set}"
query="${1?Query argument is required}"
curl -i -u "elastic:$pass" -XGET \
-H 'Content-Type: application/json' \
"https://localhost:$port/patient/_search?pretty" -d "
{
\"query\": {
\"match\": {
Verifying that "devth_.id" is my Blockstack ID. https://onename.com/devth_
@devth
devth / stacksize.clj
Last active June 20, 2017 19:02
explore the size of the clojure stack
(defn stacksize [] (try (throw (Exception. "")) (catch Exception e (count (.getStackTrace e)))))
(defn prss [] (print (stacksize) " "))
; stack size doesn't increase with proper loop/recur
(loop [x 0] (prss) (when (> 10 x) (recur (inc x))))
; 24 24 24 24 24 24 24 24 24 24 24 nil
; stack size increases with recursion
(defn rec [x continuation]
(prss)
compile: clean
# -m / --multi <dir> Write multiple files to the directory, list files on stdout
jsonnet $(JSONNET_ARGS) -m $(BUILD_DIR) $(TF_FILE)
show: compile
jsonnet $(JSONNET_ARGS) $(TF_FILE)
clean:
rm -f $(BUILD_DIR)/*.tf.json
rm -f $(BUILD_DIR)/*.tfplan
"This validates that we have enough information and correct information in our clojure.specs and
extra-datomic-schema that conforms to how we are modeling our domain, including:
1. That there is a one-to-one correspondence between 'kind' clojure.specs in the spec registry and the 'kind'
information in `extra-datomic-schema`.
"