Skip to content

Instantly share code, notes, and snippets.

View FelipeCortez's full-sized avatar
💭
🐴

Felipe FelipeCortez

💭
🐴
View GitHub Profile
@holyjak
holyjak / http-server.bb
Last active June 5, 2024 10:00
Babashka HTTP server for serving static files, similar to `python -m http.server` but more flexible :)
#!/usr/bin/env bb
#_" -*- mode: clojure; -*-"
;; Based on https://github.com/babashka/babashka/blob/master/examples/image_viewer.clj
(ns http-server
(:require [babashka.fs :as fs]
[clojure.java.browse :as browse]
[clojure.string :as str]
[clojure.tools.cli :refer [parse-opts]]
[org.httpkit.server :as server]
@lagenorhynque
lagenorhynque / github_graphql_api_client.clj
Last active March 18, 2024 20:46
A minimal GitHub GraphQL API client implemented as a babashka (Clojure) script
#!/usr/bin/env bb
(ns github-graphql-api-client
(:require
[babashka.curl :as curl]
[cheshire.core :as cheshire]
[clojure.pprint :refer [pprint]]))
(def auth-token (System/getenv "AUTH_TOKEN"))
(def graphql-query
@borkdude
borkdude / macro.clj
Last active August 19, 2020 12:40
shell macro
(require '[clojure.java.shell :as sh]
'[clojure.string :as str])
(defn format-arg [arg]
(cond
(symbol? arg) (str arg)
(seq? arg) (let [f (first arg)]
(if (and (symbol? f) (= "unquote" (name f)))
(second arg)
arg))
me:
@true
a:
@true
sandwich:
@[ "$$(id -u)" -eq 0 ] && echo "Okay." || echo "What? Make it yourself."
.PHONY: me a sandwich