This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# shellcheck shell=bash | |
# addloc 0.2.1 (beta) | |
# add CLIs to /var/db/locationd/clients.plist | |
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/local/bin:/opt/local/sbin:"$HOME"/.local/bin:"$HOME"/.local/sbin | |
rehash &>/dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; run `bb backup` to backup database | |
; run `bb restore` to restore latest backup | |
{:min-bb-version "0.4.0", | |
:tasks {; CONSTANTS | |
db-name "dev_blog", | |
backup-dir "backups", | |
now (str (java.time.LocalDateTime/now)), | |
; TASKS | |
create-backup-dir {:depends [backup-dir], :task (babashka.fs/create-dirs backup-dir)}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bb | |
;; Inspired from https://book.babashka.org/#_running_tests | |
(require '[clojure.test :as t] | |
'[clojure.string :as string] | |
'[babashka.classpath :as cp] | |
'[babashka.fs :as fs]) | |
(cp/add-classpath "src:test") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:tasks {:requires ([babashka.fs :as fs]) | |
:init (do (when (seq (fs/modified-since "deps.edn" | |
["deps.template.edn" | |
"../base/deps.edn"])) | |
(shell {:dir ".."} "script/gen-deps.clj"))) | |
;; Maintenance tasks | |
install {:doc "Install frontend dependencies from NPM" | |
:task (shell "npm install")} | |
clean {:doc "Clean all artifacts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bb | |
(require '[rewrite-clj.zip :as z]) | |
(def code "(defn foo [] (if true :a :b))") | |
(defn rewrite-if [code] | |
(let [zip (z/of-string code)] | |
(loop [zloc zip] | |
(if (z/end? zloc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.11.3 | |
RUN apk update && apk add curl ca-certificates unzip && rm -rf /var/cache/apk/* | |
RUN curl -L 'https://github.com/babashka/babashka/releases/download/v0.2.10/babashka-0.2.10-linux-static-amd64.zip' -o /tmp/bb.zip && \ | |
unzip /tmp/bb.zip && \ | |
mv bb /usr/bin/bb && \ | |
chmod +x /usr/bin/bb | |
RUN mkdir -p /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#_" -*- mode: clojure; -*-" | |
#_( | |
"exec" "clojure" "-Sdeps" "{:deps {borkdude/grasp {:git/url \"https://github.com/borkdude/grasp\" :sha \"6315cea8c0b6dafc7b1eef9ccd03d6d5590d2045\"}}}" "-M" "$0" "$@" | |
) | |
(require '[clojure.java.io :as io] | |
'[clojure.spec.alpha :as s] | |
'[clojure.string :as str] | |
'[grasp.api :as g]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bb | |
(import (java.net ServerSocket)) | |
(require '[clojure.string :as string] '[clojure.java.io :as io]) | |
(with-open [server-socket (new ServerSocket 8080) | |
client-socket (.accept server-socket)] | |
(loop [] | |
(let [out (io/writer (.getOutputStream client-socket)) | |
in (io/reader (.getInputStream client-socket)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#_( | |
#_DEPS is same format as deps.edn. Multiline is okay. | |
DEPS=' | |
{:deps {clj-time {:mvn/version "0.14.2"}}} | |
' | |
#_You can put other options here | |
OPTS=' |
NewerOlder