Skip to content

Instantly share code, notes, and snippets.

Antonio Nuno Monteiro anmonteiro

Block or report user

Report or block anmonteiro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
use syn::{self, Item, ItemMod, ItemUse, UseGroup, UsePath, UseTree};
use std::collections::HashSet;
use std::env;
use std::fs::File;
use std::io::Read;
use std::process;
fn main() {
let mut args = env::args();
View esy.json
"resolutions": {
"@opam/conf-openssl": {
"source": "no-source:",
"override": {
"dependencies": {
"@opam/conf-pkg-config": "*",
"@esy-packages/esy-openssl": "*"
View Dockerfile
FROM ocaml/opam2:alpine-3.7-ocaml-4.06
RUN sudo apk --no-cache add ca-certificates
RUN sudo apk add --update m4 openssh-client
# Setup SSH.
RUN mkdir -p ~/.ssh
RUN echo "${SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa
RUN chmod 600 ~/.ssh/id_rsa
RUN printf "Host\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
anmonteiro /
Last active Aug 5, 2018
Server-sent events in http/af
let set_interval = (s, f, destroy) => {
let rec set_interval_loop = (s, f, n) => {
let timeout =
Lwt_timeout.create(s, () =>
if (n > 0) {
set_interval_loop(s, f, n - 1);
} else {

Code Splitting

NOTE: This gist uses the master branch of ClojureScript. Clone ClojureScript and from the checkout run ./script/bootstrap and ./script/uberjar. This will produce target/cljs.jar which you can use to follow this guide.

As client applications become larger it becomes desirable to load only the code actually required to run a particular logical screen. Previously ClojureScript :modules compiler option permitted such code splitting, but this feature only worked under :advanced compilation and users would still have to manage loading these splits. :modules also required manual

ffmpeg -i "$1" -vf scale=800:-1 -pix_fmt rgb24 -r 10 -f image2pipe -vcodec ppm - |\
convert -delay 10 -layers Optimize -loop 0 - "$2"

Demo of the new "require outside NS" feature in ClojureScript

Given the following directory structure, where cljs.jar is a ClojureScript uberjar built from source (the feature is currently unreleased, follow these instructions and build the compiler with script/uberjar):

├─ src
│  └─ foo.cljs
└─ cljs.jar
View merge-sends.cljs
(defn custom-merge-sends [a b]
(let [a (cond->> a
(not (every? (set (keys a)) (keys b)))
(merge (zipmap (keys b) (repeat []))))]
(merge-with #(into %1 (mapcat identity) %2) a b)))
anmonteiro /
Last active Sep 9, 2017
Use Om Next from Planck.
set -e
if [ ! -d "om" ]; then
git clone -b self-host --depth=1
if [ ! -e "om/react-dom-server.jar" ]; then
curl -s -L -o om/react-dom-server.jar

Keybase proof

I hereby claim:

  • I am anmonteiro on github.
  • I am anmonteiro ( on keybase.
  • I have a public key whose fingerprint is 6E21 4AFF 1F0F 7E8E 1F14 6E8B 3EF0 52D0 A849 4FE9

To claim this, I am signing this object:

You can’t perform that action at this time.