Skip to content

Instantly share code, notes, and snippets.

View sfertman's full-sized avatar
💭
🐗 🌳

sfertman

💭
🐗 🌳
View GitHub Profile
@sfertman
sfertman / .docker_aliases
Created May 29, 2020 18:11 — forked from cjus/.docker_aliases
Docker aliases
#!/bin/sh
alias dm='docker-machine'
alias dmx='docker-machine ssh'
alias dk='docker'
alias dki='docker images'
alias dks='docker service'
alias dkrm='docker rm'
alias dkl='docker logs'
alias dklf='docker logs -f'
@sfertman
sfertman / gh-grapfql.sh
Last active May 15, 2020 22:21
graph QL command line peculiarities
curl -H "Authorization: bearer <token>" -X POST -d \
'{"query": "query { repository(owner:\"octocat\", name:\"Hello-World\") { issues(last:20, states:CLOSED) { edges { node { title url labels(first:5) { edges { node { name}}}}}}}}"}' \
https://api.github.com/graphql
@sfertman
sfertman / no-curl-healthcheck.sh
Created May 8, 2020 19:49
Docker --health-cmd without curl; use wget
wget -q -S -O - --spider <host>:<port>/<path> &>/dev/null; [ $? -eq 0 ] || exit 1
@sfertman
sfertman / hold-the-bloat.clj
Last active April 14, 2020 17:58
Print stack-trace; hold the bloat
(defn starts-with-any?
[s prefixes]
(some #(clojure.string/starts-with? s %) prefixes))
(defn pprnex
"Print stack-trace; hold the bloat"
[ex]
(let [bloat ["sun." "java." "clojure."]]
(clojure.pprint/pprint

get latest commit of specific file

git log -n 1 --pretty=oneline -- <file-name.ext> | cut -f 1 -d'
@sfertman
sfertman / riot-matrix-workshop.md
Created October 15, 2019 15:29 — forked from attacus/riot-matrix-workshop.md
Create your own encrypted chat server with Riot and Matrix

This guide is unmaintained and was created for a specific workshop in 2017. It remains as a legacy reference. Use at your own risk.

Running your own encrypted chat service with Matrix and Riot

Workshop Instructor:

This workshop is distributed under a CC BY-SA 4.0 license.

What are we doing here?

https://stackoverflow.com/a/45074641
@sfertman
sfertman / macros.clj
Created September 11, 2019 01:25
misc useful shortcuts for clojure repl
(def mx1 (comp pprint macroexpand-1))
@sfertman
sfertman / webservers.md
Created September 9, 2019 14:39
webservers

Netcat as web server:

#!/bin/sh
while true; do
echo -e "HTTP/1.1 200 OK\r\n $(cat /var/www/index.html)" |
nc -lp 1500 -q 1
sleep 1
done
@sfertman
sfertman / test_f.clj
Last active August 29, 2019 03:17
homebrew testing "framework" to save typing for simple unit testing
(defn test-f
"Tests f on given test cases.
f: function under test
cs: vectors of 2 or 3 where each is: [in-args exp-out eq-op]
with elements:
- in-args: function under test input arguments
- exp-out: expected output
- eq-op: equality operator to apply for expected vs. result comparisson;
if not given, defaults to ="
[f & cs]