Skip to content

Instantly share code, notes, and snippets.

@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
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)
@WetHat
WetHat / CL-PrettyPrintTableData.ipynb
Last active April 20, 2025 16:44
Pretty Print Table Data in Common Lisp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@NoraCodes
NoraCodes / work_queue.rs
Last active November 28, 2024 10:37
An example of a parallel work scheduling system using only the Rust standard library
// Here is an extremely simple version of work scheduling for multiple
// processors.
//
// The Problem:
// We have a lot of numbers that need to be math'ed. Doing this on one
// CPU core is slow. We have 4 CPU cores. We would thus like to use those
// cores to do math, because it will be a little less slow (ideally
// 4 times faster actually).
//
// The Solution:
@BretFisher
BretFisher / docker-for-mac.md
Last active March 31, 2025 10:12
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@chaitanyagupta
chaitanyagupta / _reader-macros.md
Last active April 25, 2025 03:09
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@malexer
malexer / zmq_http_server_example.py
Created January 28, 2014 10:02
Hello World HTTP server in pyzmq (using ZeroMQ RAW socket) - a Python version of http://gist.github.com/hintjens/5480625
import zmq
DEFAULT_PAGE = '\r\n'.join([
"HTTP/1.0 200 OK",
"Content-Type: text/plain",
"",
"Hello, World!",
])
@tylerneylon
tylerneylon / learn.lua
Last active April 26, 2025 14:17
Learn Lua quickly with this short yet comprehensive and friendly script. It's written as both an introduction and a quick reference. It's also a valid Lua script so you can verify that the code does what it says, and learn more by modifying and running this script in your Lua interpreter.
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
anonymous
anonymous / gist:4373692
Created December 25, 2012 15:18
Distributed chat over ZeroMQ
//
// Distributed chat example
//
#include <czmq.h>
static void
listener_task (void *args, zctx_t *ctx, void *pipe)
{
void *listener = zsocket_new (ctx, ZMQ_SUB);
int address;
@stephenc
stephenc / gist:3053561
Created July 5, 2012 13:05
Continuous Deployment with Jenkins and Puppet

Puppet with Jenkins

Setup Jenkins

With Puppet:

puppet module install rtyler-jenkins

puppet apply -v -e "include jenkins"