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 May 27, 2024 23:12
Pretty Print Table Data in Common Lisp
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 February 21, 2024 15:27
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:
@chaitanyagupta
chaitanyagupta / _reader-macros.md
Last active May 19, 2024 19:25
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 May 16, 2024 05:47
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"

@ksamuel
ksamuel / gist:1521153
Created December 26, 2011 13:30
Urwid chat UI
#!/usr/bin/env python
# coding: UTF-8
# code extracted from nigiri
import os
import datetime
import sys
import traceback
import re