Skip to content

Instantly share code, notes, and snippets.

View acron0's full-sized avatar
🇬🇧

Antony Woods acron0

🇬🇧
View GitHub Profile
@theronic
theronic / Dockerfile
Created May 30, 2022 16:23
Deploy Clojure to Fly.io: Efficient Multi-stage Docker build to Deploy Clojure Application to Fly.io
FROM clojure:openjdk-15-tools-deps AS builder
WORKDIR /opt
ADD deps.edn deps.edn
RUN clj -Sdeps '{:mvn/local-repo "./.m2/repository"}' -e "(prn \"Downloading deps\")"
RUN clj -e :ok
COPY . .
RUN clj -e :ok
@prasmalla
prasmalla / plutus-pioneer-osx.sh
Created April 8, 2021 14:58
getting started with plutus pioneer on osx
#[optional] Installing Libsodium - ONLY if you do not want nix to handle this - otherwise skip
git clone https://github.com/input-output-hk/libsodium
cd libsodium
git checkout 66f017f1
./autogen.sh
./configure
make
sudo make install && cd ..
#Export and source ~/.bashrc
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
@stuarthalloway
stuarthalloway / missing_keys_specs.clj
Created October 14, 2017 11:44
I think it would be a mistake to introduce temporal coupling to prevent typos.
;; I think it would be a mistake to introduce temporal coupling to prevent typos.
;; The example program below lets you identify "missing" keys specs at
;; the time and place of your choosing, and then handle them as you
;; deem appropriate, without imposing those decisions on other
;; users of spec.
(require '[clojure.spec.alpha :as s]
'[clojure.set :as set])
@conan
conan / url-gen.clj
Created October 4, 2017 14:13
Clojure.spec URL and email specs with generators
(require '[cemerick.url :as url]
'[clojure.spec.alpha :as s]
'[clojure.spec.gen.alpha :as gen]
'[clojure.string :as string])
(def non-empty-string-alphanumeric
"Generator for non-empty alphanumeric strings"
(gen/such-that #(not= "" %)
(gen/string-alphanumeric)))
@chr15m
chr15m / set_timeout.cljs
Last active March 24, 2017 16:09
ClojureScript setTimeout that fires reliably in a background tab.
; uses a web worker background thread
(let [metronome-worker-js "self.onmessage=function(e){setTimeout(function(){postMessage(e.data);},e.data.interval);};console.log('Metronome worker loaded.');"
worker-blob (js/Blob. (clj->js [metronome-worker-js]) {:type "application/javascript"})
worker (js/Worker. (.createObjectURL js/URL worker-blob))
call-id (atom 0)]
(defn make-worker-listener [id callback]
(fn [e]
(when (= e.data.id id)
(callback)
;; Based on https://clojuredocs.org/clojure.core/condp#example-542692cbc026201cdc326bea
(defn parse-arg [s]
(condp (comp next re-matches) s
#"([+-])(\w+)" :>> (fn [[f k]] [(keyword k) (= f "+")])
#"(\w+)=(\w+)" :>> (fn [[k v]] [(keyword k) v])
(throw (IllegalArgumentException. s))))
(parse-arg "+foo") ;=> [:foo true]
(parse-arg "-foo") ;=> [:foo false]
@yogthos
yogthos / help-wanted.md
Created October 7, 2015 00:07
projects with some labeled low hanging fruit issues

Git hooks suggestions

Problem Statement

With a centralized workflow we expect the branch master to be what's deployed /deployable to production. Changes are implemented on feature branches (typically named feature/<feature-name>) and merged into master via Github Pull request UI workflow.

This works fine, but occasionally a developer can make an error and push to master. We'd like to put some additional checks in place to protect against that.

Git version 1.9.x vs version 2.x.x

@enjalot
enjalot / cors_server.py
Created June 10, 2012 06:19
Allow CORS with python simple http server
import SimpleHTTPServer
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or