Adapted from: https://github.com/babashka/pod-babashka-parcera/blob/master/examples/sort_requires.clj
#!/usr/bin/env bb
(require '[babashka.pods :as pods])
(pods/load-pod "pod-babashka-parcera")
(require '[pod.babashka.parcera :as parcera])
(defn sort-ns [node]
This file contains hidden or 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 '[clojure.java.io :as io]) | |
| (require '[bencode.core :refer [read-bencode]]) | |
| (require '[clojure.walk :refer [prewalk]]) | |
| (require '[clojure.pprint :refer [pprint]]) | |
| (import 'java.io.PushbackInputStream) | |
| (defn bytes->strings [coll] | |
| (prewalk #(if (bytes? %) (String. % "UTF-8") %) coll)) |
This file contains hidden or 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
| (ns gitlab.clone-group | |
| (:require | |
| [cheshire.core :as json] | |
| [gitlab.api :refer [get-config]] | |
| [babashka.curl :as curl] | |
| [clojure.java.io :as io] | |
| [clojure.tools.cli :refer [parse-opts]] | |
| [babashka.process :refer [$]])) | |
| (defn clone-all-repos-from-group [{:keys [gitlab-token gitlab-root group-id local-root]}] |
This file contains hidden or 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 '[babashka.curl :as curl]) | |
| (require '[cheshire.core :as json]) | |
| (def recent-build-count 40) | |
| (defn recent-builds-url | |
| [ci user project limit status] | |
| (str "https://circleci.com/api/v1.1/project/" ci "/" user "/" project "?limit=" limit "&filter=" status)) |
This file contains hidden or 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
| #_( ;; Allow this script to be executed directly | |
| "exec" "bb" -o "--classpath" "." "$0" "$@" | |
| ) | |
| ;; Copyright © 2020, Malcolm Sparks | |
| ;; Permission is hereby granted, free of charge, to any person obtaining a copy | |
| ;; of this software and associated documentation files (the “Software”), to deal | |
| ;; in the Software without restriction, including without limitation the rights | |
| ;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains hidden or 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 | |
| (ns script | |
| "Make a 'Code Quality' report from clj-kondo for use in GitLab CI. | |
| JSON issue format: | |
| https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool | |
| Usage: | |
| Add the following job in .gitlab-ci.yml: |
This file contains hidden or 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 | |
| (defn random-bytes | |
| [n] | |
| (with-open [in (io/input-stream (io/file "/dev/urandom"))] | |
| (let [buf (byte-array n)] | |
| (.read in buf) | |
| buf))) | |
| (defn random-number |
This file contains hidden or 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 | |
| ;; convert.clj -- babashka edn/json/yaml to edn/json/yaml converter | |
| ;; Author: github.com/KGOH/ | |
| ;; Source: gist.github.com/KGOH/50c0f66022fea2ac173518a143238058 | |
| ;; Version: 2020.4 | |
| ; Usage example: | |
| ; In Emacs: i.imgur.com/TIEDmga.mp4 | |
| ; $ convert.clj edn <<< '{"foo": "bar"}' | |
| ; {:foo "bar"} |
This file contains hidden or 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
| .ONESHELL: | |
| test: .SHELLFLAGS := -i | |
| test: SHELL := bb | |
| test: | |
| (println :wow) | |
| (require '[clojure.string :as s]) | |
| (s/reverse (slurp "./Makefile")) | |