Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# temp file
t=/tmp/bipe.$$.txt
touch $t
# read from stdin
if [ ! -t 0 ]; then
cat > $t
@anypercent
anypercent / gist:3a56ee569ae271aafb8044f10b39baa7
Created September 11, 2021 21:07
top 100 solamanders listed on digitaleyes
ranking price link
76 7 https://digitaleyes.market/item/7r8oLSVhJTN4kiGEfaBpEbcFVFgR1y8FyMVgeyKcYqHu
56 11 https://digitaleyes.market/item/77t27sPYMjzFxfh7CfNbCvPNrDNPZUyato87gRyjcxnW
60 11.4 https://digitaleyes.market/item/66ajoiSKRZdkiZiu6Rzb9TdJs6PnH7T8GP4u3tdZuEsf
79 13 https://digitaleyes.market/item/HQN7o6apRMfj6o8GdUgM6fy5YRRD9trpeNAWVr7ixbdf
17 15 https://digitaleyes.market/item/FuXgMCGBwyiMFwtZoAG7EjbzTzDQxi2SdtMSnHq7RtSS
89 15 https://digitaleyes.market/item/Euss8ejH1ouaaMEuKo1dnfcg3XsAzBa9zXPJRwi1R5Pn
51 16 https://digitaleyes.market/item/CRPYKua576bg8LUefia16zSZRcXMQpSe5ydiKbXanjfC
48 20 https://digitaleyes.market/item/5tsNXSU3utmgcjwt4APWQXeNDyxQPPnJDTeS5WYVpUbx
28 21 https://digitaleyes.market/item/47Mx4hAF7Cpsu771pSfNGJv4p5xG95vsowYjAxopaAdp
@didibus
didibus / clojure-right-tool.md
Last active February 3, 2025 02:38
When is Clojure "the right tool for the job"?

My answer to: https://www.reddit.com/r/Clojure/comments/pcwypb/us_engineers_love_to_say_the_right_tool_for_the/ which asked to know when and at what is Clojure "the right tool for the job"?

My take is that in general, the right tool for the job actually doesn't matter that much when it comes to programming language.

There are only a few cases where the options of tools that can do a sufficiently good job at the task become limited.

That's why they are called: General-purpose programming languages, because they can be used generally for most use cases without issues.

Let's look at some of the dimensions that make a difference and what I think of Clojure for them:

@matthewdowney
matthewdowney / web3.clj
Created August 28, 2021 00:18
Call a smart contract from Clojure to query data from the Ethereum blockchain.
(ns web3
"Call an Ethereum smart contract (Uniswap v2) from Clojure.
Requires https://github.com/clj-python/libpython-clj for python interop. Also
make sure to $ pip install web3."
(:require [libpython-clj2.python :as py]
[libpython-clj2.require :refer [require-python]]))
(comment ;; deps.edn
@didibus
didibus / complex_business_process_example.clj
Last active August 20, 2024 20:35
Example of a complex business process to implement in Clojure. Please link to your solutions for alternative ways to implement the same in Clojure (or other languages).
(ns complex-business-process-example
"A stupid example of a more complex business process to implement as a flowchart.")
;;;; Config
(def config
"When set to :test will trigger the not-boosted branch which won't write to db.
When set to :prod will trigger the boosted branch which will try to write to the db."
{:env :prod})
@chrispsn
chrispsn / war_on_raze.md
Last active February 9, 2024 02:45
WAR ON RAZE

WAR ON RAZE

This is the story of what happened when I went down a rabbit hole.

It starts with k7. If you press Ctrl-] in the k7 WASM console, this appears:

x^x*/:x:2_!100

That's a prime number filter. There are faster ones - kparc.com's x,1_&&/80#'!:'x is beautiful - but this one is really short.

(ns catching-transduce
"See [[catching-transduce]] below"
(:require [clojure.core.async :as a :refer [chan to-chan pipeline-blocking <!!]]))
(defmacro err-or
"If body throws an exception, catch it and return it"
[& forms]
`(try
~@forms
(catch Throwable t# t#)))
@holyjak
holyjak / http-server.bb
Last active September 6, 2024 15:17
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]
@davestevens
davestevens / README.md
Created February 19, 2021 17:01
Fetching all comments from a Reddit post

Reddit API

I could not find a simple example showing how to consume the Reddit API to get the comments for a post. This shows step by step how to authenticate and the endpoints to request.

Setup

You need to create an app to get an app id and secret. Go to https://www.reddit.com/prefs/apps and at the bottom of the page under "developed applications" create a new app or view a current one.

If you click "edit" to open the app view you will be able to see the app id and secret, these are required for authentication.

(do
(clojure.core.server/start-server
{:port 4567
:name "my-prepl"
:accept 'clojure.core.server/io-prepl})
(with-open [s (java.net.Socket. "localhost" 4567)
i (-> (.getInputStream s)