Skip to content

Instantly share code, notes, and snippets.

If anything is worth doing, do it with all your heart. --Buddha

Norman Eckstein ITSecMedia

If anything is worth doing, do it with all your heart. --Buddha
View GitHub Profile
ITSecMedia /
Created Oct 7, 2021 — forked from pesterhazy/
Promises in ClojureScript

Chaining promises

Chaining promises in ClojureScript is best done using the thread-first macro, ->. Here's an example of using the fetch API:

(-> (js/fetch "/data")
    (.then (fn [r]
             (when-not (.-ok r)
               (throw (js/Error. "Could not fetch /data")))
             (.json r)))
View humblebundle-download-folder-creation-utility.clj
;; Take a textfile which contains a copy of the raw html of a humblebundle user account download
;; select the download page html table with the mouse copy+paste in a textfile
;; Use this file to create a list of folders based on the download names.
;; Book of Making – Volume 1
;; Raspberry Pi Press
;; PDF
;; 49 MB md5
View all-lein-templates.txt
87 luminus: a template for creating Luminus applications
7 mala: A Leiningen template for Mala
1 maple: A leinginen template with MPL
3 mesos-framework: A template for setting up mesos-frameworks using component.
3 mies-brepl: A minimal ClojureScript project template with REPL
7 mies-node: A minimal ClojureScript Node.js project template
27 mies-om: A minimal Om project template
2 mies-weasel: A minimal ClojureScript project template with Weasel REPL, forked from mies.
40 mies: A minimal ClojureScript project template
3 mies: FIXME: write description
ITSecMedia / all-lein-templates.txt
Created Jul 25, 2020 — forked from anonymous/all-lein-templates.txt
for i in {1..28} ; do lein search lein-template $i ; done | grep '^\[' | perl -pe 's,^\[,,; s,/.*?],:,' | sort | uniq -c | tee all-lein-templates.txt
View all-lein-templates.txt
1 acorn: A Leiningen template for a ClojureScript setup with Figwheel, Austin, Om.
8 amp: Leiningen template for AMP (Alfresco Module Package) projects.
1 angular-cl2: A Leiningen template for using AngularJS and ChlorineJS
1 angular: Clojure and AngularJS in perfect harmony.
6 angular: Clojure and AngularJS in perfect harmony. $ lein new angular <name>
2 angularjs-app: Leiningen template for web application with http-kit and angularjs
5 angular-simple: Clojure and AngularJS $ lein new angular-simple <name>
1 aperiodic-cljs: My cljs development starting point. Basically ripped from lein-cljsbuild.
1 apijr: clojurescript project template
1 appfgo: 'lein new' template for Funcgo application
ITSecMedia /
Created Mar 31, 2020 — forked from john2x/
Clojure Destructuring Tutorial and Cheat Sheet

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

View Lein.bat
@echo off
setLocal EnableExtensions EnableDelayedExpansion
set LEIN_VERSION=2.9.1
if "%LEIN_VERSION:~-9%" == "-SNAPSHOT" (
) else (
View Dapper.Extensions.fs
module Dapper.Extensions
open System
open System.Data.SqlClient
open Dapper
let extractValue (x:obj) =
match x with
| null -> null
| _ -> match x.GetType().GetProperty("Value") with
ITSecMedia / ConstrainedTypesExamples.fsx
Created May 25, 2019 — forked from swlaschin/ConstrainedTypesExamples.fsx
Examples of creating constrained types in F#
View ConstrainedTypesExamples.fsx
// General hints on defining types with constraints or invariants
// Just as in C#, use a private constructor
// and expose "factory" methods that enforce the constraints
// In F#, only classes can have private constructors with public members.
// If you want to use the record and DU types, the whole type becomes
// private, which means that you also need to provide:
// * a constructor function ("create").
ITSecMedia / gist:9cb8cf6279471531129a0a90f9556680
Created Dec 15, 2017 — forked from msmuenchen/gist:9318327
KeePass v2.x (KDBX v3.x) file format
View gist:9cb8cf6279471531129a0a90f9556680
Convention: Byte array notation as it would appear in a hexeditor.
= Layout=
KDBX files, the keepass database files, are layout as follows:
1) Bytes 0-3: Primary identifier, common across all kdbx versions:
private static $sigByte1=[0x03,0xD9,0xA2,0x9A];
2) Bytes 4-7: Secondary identifier. Byte 4 can be used to identify the file version (0x67 is latest, 0x66 is the KeePass 2 pre-release format and 0x55 is KeePass 1)