Skip to content

Instantly share code, notes, and snippets.

View ddeaguiar's full-sized avatar

Daniel De Aguiar ddeaguiar

  • Nubank
  • Miami, Fl
View GitHub Profile
[Unit]
Description=subgun
[Service]
ExecStartPre=-/usr/bin/docker kill subgun-%i
ExecStartPre=-/usr/bin/docker rm subgun-%i
ExecStart=/usr/bin/docker run -rm -name subgun-%i -e SUBGUN_LISTEN=127.0.0.1:8080 -e SUBGUN_LISTS=recv@sandbox2398.mailgun.org -e SUBGUN_API_KEY=key-779ru4cibbnhfa1qp7a3apyvwkls7ny7 -p 8080:8080 coreos/subgun
ExecStop=/usr/bin/docker kill subgun-%i
[X-Fleet]
#
# A simple theme that displays relevant, contextual information.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Screenshots:
# http://i.imgur.com/nBEEZ.png
#
@ddeaguiar
ddeaguiar / gist:10010756
Created April 6, 2014 19:55
Racket examples - various implementations of list-length
#lang racket
(require racket/trace)
;; Recursive implementation of list length
(define (list-length l)
(if (empty? l)
0
(defn fetch-col [] (range 100))
(defn less-than-30? [x]
(> 30 x))
(defn filter-col [a]
(filter #(every? true? ((juxt less-than-30? odd?) %)) a))
(defn report-results [col]
(println col)
@ddeaguiar
ddeaguiar / sub
Last active January 2, 2016 02:59
Racket submodule example
#lang racket
(module foo racket
(module bar typed/racket ;;submodules can leverage different languages
(provide baz three)
(define: three : Number 3)
(define (baz) '(foo bar baz))
(define (bit) '(this is private))))
#lang racket
;; Named let (Section '4.6.4 Named let' of
;; http://docs.racket-lang.org/guide/let.html)
(define (duplicate-shorthand pos lst)
(let dup ([i 0]
[lst lst])
(cond
[(= i pos) (cons (car lst) lst)]
(defn listen [el type]
(let [out (chan)]
(events/listen el type
(fn [e] (put! out e)))
out))
...
...
(defn init []
(ns noti.notify
(:require [noti.notification :as n]
[io.pedestal.service.log :as log]))
(defprotocol Notifiable
(notify! [_ x]))
(defmacro notifiable [body]
`(reify Notifiable
(notify! [_ notification]
(defun set-exec-path-from-shell-PATH ()
"Set up Emacs' `exec-path' and PATH environment variable to match that used by the user's shell.
This is particularly useful under Mac OSX, where GUI apps are not started from a shell."
(interactive)
(let ((path-from-shell (replace-regexp-in-string "[ \t\n]*$" "" (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
(setenv "PATH" path-from-shell)
(setq exec-path (split-string path-from-shell path-separator))))
(set-exec-path-from-shell-PATH)
@ddeaguiar
ddeaguiar / gist:6264782
Created August 19, 2013 00:09
tutorial.clj
(ns tutorial.core
(:require [cljminecraft.bukkit :as bk]
[cljminecraft.blocks :as bl]
[cljminecraft.events :as ev]
[cljminecraft.entity :as ent]
[cljminecraft.player :as plr]
[cljminecraft.util :as util]
[cljminecraft.logging :as log]
[cljminecraft.config :as cfg]
[cljminecraft.commands :as cmd]