Skip to content

Instantly share code, notes, and snippets.

@dnaeon
dnaeon / clojure-make-nested-map.clj
Last active February 17, 2019 23:17
clojure-make-nested-map
;;
;; Making a deeply nested map by following parent-child relations between items
;;
(defn make-items [n]
(concat [{:id 0 :name "item-root"}]
(for [x (range 1 n)] {:id x :parent (dec x) :item (format "item-%d" x)})))
(defn item-children [item coll]
(if-let [children (-> (filter #(= (:parent %) (:id item)) coll) seq)]
@dnaeon
dnaeon / keywordize-keys-strips-reader-tags.clj
Created May 30, 2018 06:29
walk/keywordize-keys strips reader tags
;;
;; When using clojure.walk/keywordize-keys record reader tags are stipped off
;;
user> (require '[clojure.walk :as walk])
nil
user> (defrecord Foo [x])
user.Foo
user> (def m {:foo (->Foo 1) :bar 2 :qux 3})
#'user/m
user> m
@dnaeon
dnaeon / bar.lisp
Created January 16, 2020 18:49
CL packages
;;;; Path: ~/quicklisp/local-projects/foo/src/bar.lisp
(defpackage foo.bar
(:nicknames :foo.bar)
(:use :cl)
(:export :my-function))
(in-package :foo.bar)
;; :arrows is not imported, but I can still access it
;;
@dnaeon
dnaeon / gist:2e37b449ddfe657ee52d6e957006cba3
Created October 8, 2020 17:35
Building SBCL on Samsung Galaxy Tab S6 Android Tablet
ECL (Embeddable Common-Lisp) 20.4.24 (git:UNKNOWN)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2013 Juan J. Garcia-Ripoll
Copyright (C) 2018 Daniel Kochmanski
Copyright (C) 2020 Daniel Kochmanski and Marius Gerbershagen
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.
Top level in: #<process TOP-LEVEL 0x637341af80>.
diff --git a/swank/sbcl.lisp b/swank/sbcl.lisp
index a09e04b3..78038659 100644
--- a/swank/sbcl.lisp
+++ b/swank/sbcl.lisp
@@ -979,7 +979,8 @@ QUALITIES is an alist with (quality . value)"
(make-location `(:file ,(namestring
(translate-logical-pathname pathname)))
'(:position 1)
- (when (eql type :function)
+ (when (and (eql type :function)
@dnaeon
dnaeon / decode-rsa-private-key.lisp
Last active November 30, 2022 05:52
Parse ASN.1 encoded RSA private key
;; Decode ASN.1 encoded private key
;;
;; RSA private key format: https://www.rfc-editor.org/rfc/rfc3447#appendix-A.1.2
;;
;; RSAPrivateKey ::= SEQUENCE {
;; version Version,
;; modulus INTEGER, -- n
;; publicExponent INTEGER, -- e
;; privateExponent INTEGER, -- d
;; prime1 INTEGER, -- p
@dnaeon
dnaeon / ningle-middleware.lisp
Created December 1, 2022 17:53
fukamachi/ningle middleware
;; ningle application with custom middlewares
;;
;; The middleware here is used to push additional context to the
;; environment which can later be used by ningle routes.
;;
;; Currently this is not possible in ningle, as ningle routes accept a
;; single argument, which represent the HTTP request parameters, and
;; this is different than the Lack/Clack routes, which accept the
;; surrounding environment instead.
;;
@dnaeon
dnaeon / PKGBUILD
Last active June 1, 2023 07:36
Arch Linux gpredict-git (AUR)
# Maintainer: not_anonymous <[email protected]>
# Contributor: Marin Atanasov Nikolov <[email protected]>
# Contributor: Andrey Semisokhin <[email protected]>
# Original Submission: Bob Finch <[email protected]>
_pkgname=gpredict
pkgname="${_pkgname}-git"
pkgver=2.3.r115.0f3beb6
pkgrel=1
pkgdesc='Gpredict satellite tracking application'
@dnaeon
dnaeon / PKGBUILD
Created June 1, 2023 07:37
Arch Linux sdrpp-git (AUR)
# Maintainer: Alexandre Rouma <[email protected]>
# Maintainer: éclairevoyant
# Contributor: Marin Atanasov Nikolov <[email protected]>
_pkgname=sdrpp
pkgname="${_pkgname}-git"
pkgver=1.0.4.r479.3a06612
pkgrel=1
epoch=
@dnaeon
dnaeon / sdrpp-git.diff
Created June 1, 2023 14:32
sdrpp-git diff
diff --git a/.SRCINFO b/.SRCINFO
index 281841c..a66ff62 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,29 +1,33 @@
pkgbase = sdrpp-git
- pkgdesc = The Bloat-free SDR Receiver
- pkgver = 1.0.4.r462.3336ae4
+ pkgdesc = Cross-Platform SDR Software
+ pkgver = 1.0.4.r479.3a06612