Skip to content

Instantly share code, notes, and snippets.

Avatar
⌨️
bashing keybindings

Ronen narkisr

⌨️
bashing keybindings
View GitHub Profile
@philoskim
philoskim / cljs-ns.adoc
Last active May 4, 2018
How to get *ns* string in ClojureScript
View cljs-ns.adoc

How to get *ns* string in ClojureScript

It’s not so easy to get *ns* string in ClojureScript as you might expect but here is a tip.

It is impossible to get *ns* string at run-time in ClojureScript (except in self-hosted ClojureScript) but it can be accessed at compile-time only. So you have to use a macro to get it as the following example.

I came up with this idea in the course of implementing set-ns-blacklist! and set-ns-whitelist! (https://github.com/philoskim/debux#debux-config) in my debux library.

@mfikes
mfikes / fast.md
Last active Feb 20, 2021
Fast Clojure REPL
View fast.md

An experimental change for fast Clojure REPL startup:

  1. Download the JAR: clojure-1.8.0-fast.jar
  2. Launch it via java -jar clojure-1.8.0-fast.jar

The code used to create this JAR is on GitHub.

What's it doing?

It is:

@mpeven
mpeven / setup.sh
Last active Jul 21, 2017
Pi3 Hotspot Huawei-in WiFi-out
View setup.sh
# This version:
# brings WiFi in from the Huawei adapter on eth1
# pushes WiFi out from the built in adapter on wlan0
# sets up an ip address on 192.168.5.2 to ssh into from another computer
##################################################
# Update
#
#sudo apt-get update
#sudo apt-get -qq upgrade
@pdamoc
pdamoc / README.md
Last active Mar 26, 2016
Integrating ports with Elm Architecture
View README.md

Instructions

  • compile the SendToPort.elm to elm.js
    elm-make SendToPort.elm --output elm.js
  • open SendToPort.html

Observations

@nberger
nberger / gist:fc636d8c2712b38a39f5
Last active Dec 18, 2018
riemann - send email when there are more than 5 critical events every 30 seconds
View gist:fc636d8c2712b38a39f5
; http://stackoverflow.com/questions/31269170/event-count-at-certain-time-interval-in-riemann
(let [email (mailer {:host "localhost"
:port 1025
:from "abc@gmail.com"})]
(streams
(where (and (service "system_log")
(description "IE")
(not (expired? event)))
; we are interested in the event count, so let's fix to :metric 1
@favila
favila / async-util.clj
Created Nov 28, 2014
Some missing pieces of core.async. as-transducer: Make a transducer function easily without Clojure 1.7. go-pipe: async/pipe, but returns the go-loop. fast-pipeline-blocking: faster than async/pipeline-blocking, but unordered results. blocking-consumer: consume a channel with multiple worker threads.
View async-util.clj
(ns favila.async-util
"Some missing pieces of core.async.
as-transducer: Make a transducer function easily without Clojure 1.7.
go-pipe: async/pipe, but returns the go-loop.
fast-pipeline-blocking: faster than async/pipeline-blocking, but unordered results.
blocking-consumer: consume a channel with multiple worker threads."
(:require [clojure.core.async :as async
:refer [go go-loop <! >! <!! >!! close! take! put! chan]]))
View foami.clj
(ns foami.core
"FOreign Asynchronous Mechanism Interop"
(:require [clojure.core.async :as async]))
(defn put!
"Takes a `ch`, a `msg`, a single arg function that when passed `true` enables backpressure
and when passed `false` disables it, and a no-arg function which, when invoked, closes the
upstream source."
[ch msg backpressure! close!]
(let [status (atom :sending]
@akiatoji
akiatoji / Clojure_on_RaspberryPi_OSX.md
Last active Apr 22, 2022
Running Clojure on Raspberry Pi with OS X
View Clojure_on_RaspberryPi_OSX.md

Clojure on Raspberry Pi with OS X

"Clojure running on Raspberry Pi" sounded so cool that I just had to give it a try.

Install JDK

  • Download ARM JDK from Oracle and instlal on Raspberry Pi
  • Change visudo to contain the following
@ptaoussanis
ptaoussanis / transducers.clj
Last active Dec 17, 2021
Quick recap/commentary: Clojure transducers
View transducers.clj
(comment ; Fun with transducers, v2
;; Still haven't found a brief + approachable overview of Clojure 1.7's new
;; transducers in the particular way I would have preferred myself - so here goes:
;;;; Definitions
;; Looking at the `reduce` docstring, we can define a 'reducing-fn' as:
(fn reducing-fn ([]) ([accumulation next-input])) -> new-accumulation
;; (The `[]` arity is actually optional; it's only used when calling
;; `reduce` w/o an init-accumulator).
@john2x
john2x / 00_destructuring.md
Last active May 19, 2022
Clojure Destructuring Tutorial and Cheat Sheet
View 00_destructuring.md

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences