Skip to content

Instantly share code, notes, and snippets.

;;; Slime/Swank Setup
(defun multiline? (string)
"True if the string has multiple lines."
(position ?\n string))
(defun multiline-comment (string)
"Return string formatted as a multi-line Lisp comment"
(concat "#||\n" string "\n||#\n"))
-- discipline + punish
--
-- four outputs (subjects) process input 1 through randomized transfer functions (disciplines)
-- a trigger in input 2 selects a subject based on a fifth, secret discipline,
-- and punishes it, altering its transfer function
function rand10vpp()
return math.random() * 10 - 5
end
@onlurking
onlurking / programming-as-theory-building.md
Last active April 19, 2024 22:31
Programming as Theory Building - Peter Naur

Programming as Theory Building

Peter Naur

Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct

@shakna-israel
shakna-israel / LetsDestroyC.md
Created January 30, 2020 03:50
Let's Destroy C

Let's Destroy C

I have a pet project I work on, every now and then. CNoEvil.

The concept is simple enough.

What if, for a moment, we forgot all the rules we know. That we ignore every good idea, and accept all the terrible ones. That nothing is off limits. Can we turn C into a new language? Can we do what Lisp and Forth let the over-eager programmer do, but in C?


# If you, like me, have all of your various source-code-like projects in ~/src/
# this is how to give yourself per-project shell history.
#
# I wish I'd done this years ago.
#
# First, in your .bashrc file, you redefine the cd, pushd and popd builtins to be "do the builtin bit,
# then do one other thing (set_src_history.sh, below) like so:
cd () {
@vi
vi / split_by_silence.sh
Last active February 23, 2024 13:18
Using FFmpeg to split multimedia file into parts based on audio volume level
#!/bin/bash
IN=$1
OUT=$2
true ${SD_PARAMS:="-55dB:d=0.3"};
true ${MIN_FRAGMENT_DURATION:="20"};
export MIN_FRAGMENT_DURATION
if [ -z "$OUT" ]; then
@guicho271828
guicho271828 / case.lisp
Last active May 5, 2018 18:51
case -> jump table (see fcase8, fcase9)
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
(ros:ensure-asdf)
#+quicklisp (ql:quickload '(:alexandria :trivia :iterate) :silent t))
(defpackage :ros.script.case.3724474528
@indigoviolet
indigoviolet / postgres_queries_and_commands.sql
Created November 15, 2016 00:26 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links
@DarinM223
DarinM223 / Concepts.md
Last active February 9, 2024 16:02
Rust concept explanations

My explanation of the main concepts in Rust

There are three main concepts with Rust:

  1. Ownership (only one variable "owns" the data at one time, and the owner is in charge of deallocating)
  2. Borrowing (you can borrow a reference to an owned variable)
  3. Lifetimes (all data keeps track of when it will be destroyed)

These are fairly simple concepts, but they are often counter-intuitive to concepts in other languages, so I wanted to give a shot at