Skip to content

Instantly share code, notes, and snippets.

@certik
certik / a.f90
Created January 18, 2024 17:20
module semigroup_m
!! A semigroup is a type with a sensible operation for combining two objects
!! of that type to produce another object of the same type.
!! A sensible operation has the associative property (i.e. (a + b) + c == a + (b + c))
!! Given this property, it also makes sense to combine a list of objects of
!! that type into a single object, or to repeatedly combine an object with
!! itself. These operations can be derived in terms of combine.
!! Examples include integer (i.e. +), and character (i.e. //)
implicit none
private
@ilius
ilius / prefix.txt
Created April 16, 2023 17:23
English prefixes and suffixes
a
ab
abs
ac
acantho
acet
aceto
acro
actino
ad
@phoe
phoe / forever.md
Last active February 22, 2024 23:50
Forever Stable Branch

Forever Stable Branch

Stable branch, I can see you in the stable branch
See you again, I see you again
In my dreams, in my dreams, in my dreams, in my dreams

Morning light, I remember the morning li-i-i-i-ight
Outside my door (outside my door), I'll see you no more (see you no more)
In my dreams, in my dreams, in my dreams, in my dreams
>

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
(defun expand-cxr (ads)
(labels ((expand (ads)
(cond
((null ads) 'x)
((equalp (car ads) #\a) `(cl:car ,(expand (cdr ads))))
(t `(cl:cdr ,(expand (cdr ads)))))))
(let* ((nam (coerce `(#\c ,@ads #\r) 'string))
(sym (intern (ecase (readtable-case *cxr-readtable*)
((:upcase) (string-upcase nam))
((:downcase) (string-downcase nam))
@shirok
shirok / cxr.lisp
Last active February 11, 2025 21:45
(defvar *original-readtable* *readtable*)
(defvar *cxr-readtable* (copy-readtable *original-readtable*))
(defconstant +constituents+
(remove-if #'get-macro-character
"!$%&0123456789<=>?[]^_{}~.+-*/@ABCDEFGHIJKLMNOPQRTSUVWXYZabcdefghijklmnopqrstuvwxyz"))
(defun cxr-reader (stream char)
(let* ((chars (loop with cs = `(,char)
for c = (peek-char nil stream nil nil t)
@jhoneill
jhoneill / demo.ps1
Last active February 15, 2022 08:17
# rev 0.2 added more comments, and made the regax a bit more precise.
function SplitEmUp {
param (
$paramString
)
#This regex will isolate quoted blocks e.g. " -example )( $quote "
# and will identify matching open and close () {} and [] even if nested.
$opensAndCloses = @'
(?x) # Allow comments and ignore spaces and line breaks in the layaout.
^(?> # Start and make the repeating group ‘atomic’.
@jhoneill
jhoneill / Show-help.ps1
Created February 4, 2021 17:48
A PowerShell Productivity hack - put help in it's own window
function Show-Help {
<#
.Synopsis
Open help in "Show window" mode
#>
param (
[parameter(ValueFromPipeline=$true)]
[ArgumentCompleter({
param($commandName, $parameterName,$wordToComplete,$commandAst,$fakeBoundParameter)
[System.Management.Automation.CompletionCompleters]::CompleteCommand($wordToComplete)
@webb
webb / simple-cli-parser.bash
Created October 2, 2020 15:18
A simple CLI parser in Bash
#!/usr/bin/env bash
print_help () { echo "Option -f \${file}: Set file"; exit 0; }
fail () { echo "Error: $*" >&2; exit 1; }
unset file
OPTIND=1
while getopts :f:h-: option
do case $option in
h ) print_help;;
@bluekezza
bluekezza / nohup_function.sh
Created June 9, 2020 11:45
Calling a function using nohup
function function_to_run {
while true
do
echo "function1"
sleep 1
done
}
function main {
( # start a group. The statements will be executed in a sub-shell (see https://www.gnu.org/software/bash/manual/html_node/Command-Grouping.html#Command-Grouping)