Skip to content

Instantly share code, notes, and snippets.

View pmonks's full-sized avatar
👔
Preparing TPS report cover pages

Peter Monks pmonks

👔
Preparing TPS report cover pages
View GitHub Profile
@pmonks
pmonks / deps.edn
Last active July 7, 2024 00:58
Super simple example of a Discord slash command implemented in Clojure, that provides a /echo command that simply echos its input. Uses the discljord and slash libraries.
;
; Copyright © 2024 Peter Monks
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
@pmonks
pmonks / java-members.clj
Last active November 13, 2023 19:46
Pretty prints results from clojure.reflect/reflect on an object or class in an idiomatic Clojure fashion
;
; Copyright © 2023 Peter Monks
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
@pmonks
pmonks / README.md
Last active October 12, 2022 22:34 — forked from johan-carlsson/gist:6aec54a93aafadd198dc7125779ce6f3
Clojure friendly mode with nrepl starting on port 7888, inspired by https://github.com/slipset/friendly
@pmonks
pmonks / martian_alfresco.clj
Last active August 9, 2021 20:31
Quick play with Martian, using some Alfresco API definitions
;
; Copyright © 2021 Peter Monks
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
@pmonks
pmonks / deps-nses.clj
Last active August 9, 2021 20:40
Get the namespaces for one or more Clojure deps
;/*********************************************************************
;* Copyright (c) 2021-01-12 Peter Monks
;*
;* This program and the accompanying materials are made
;* available under the terms of the Eclipse Public License 2.0
;* which is available at https://www.eclipse.org/legal/epl-2.0/
;*
;* SPDX-License-Identifier: EPL-2.0
;**********************************************************************/
;
; Copyright © 2020 Peter Monks
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
@pmonks
pmonks / better-file-seq.clj
Created June 10, 2020 04:05
A tree seq on java.io.Files that doesn't follow symlinks (requires Java 1.7+)
(defn file-seq
"A tree seq on java.io.Files that doesn't follow symlinks"
[dir]
(tree-seq
(fn [^java.io.File f] (and (.isDirectory f) (not (java.nio.file.Files/isSymbolicLink (.toPath f)))))
(fn [^java.io.File d] (seq (.listFiles d)))
dir))
@pmonks
pmonks / line-at-a-time-corrected.clj
Last active June 6, 2020 01:08
Clojure/babashka implementation of wc, inspired by https://github.com/ChrisPenner/wc
#!/usr/bin/env bb
;
; Copyright © 2020 Peter Monks Some Rights Reserved
;
; This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
; To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a
; letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
;
; Inspired by https://github.com/ChrisPenner/wc - this code diverges from the remaining Haskell examples
@pmonks
pmonks / quil-radar-chart.clj
Last active November 19, 2018 19:24
quil-radar-chart.clj
; Start a REPL with `lein try quil`, on JDK 1.8 (quil is not yet functional on JRE 9+)
(require '[quil.core :as q])
; Tunables (feel free to play with these)
(def window-size [1000 1000]) ; Initial size of the window
(def num-dimensions 9) ; Number of "dimensions" (spokes) to draw
(def num-circles 10) ; Number of circles in the chart
(def save-image (atom true)) ; Save the image (to a PNG) once, after it's first drawn
; Other constants (do not touch!)

Keybase proof

I hereby claim:

  • I am pmonks on github.
  • I am pmonks (https://keybase.io/pmonks) on keybase.
  • I have a public key ASCxXap2ro4H4RZvS9DP6oEMvE4uCx-z-eOCBZZj5aj5SQo

To claim this, I am signing this object: