Skip to content

Instantly share code, notes, and snippets.

View fstamour's full-sized avatar

Francis St-Amour fstamour

View GitHub Profile
(defun iota (m &optional (n 1) (step 1))
(defun iter (m n lst)
(cond ((> n m) (reverse lst))
(t (iter m (+ n step) (cons n lst)))))
(iter m n nil))
@fstamour
fstamour / pipe-to-emacs.py
Created March 5, 2021 13:07 — forked from garaud/pipe-to-emacs.py
Pipe to Emacs: Insert a result from an UNIX command into a new Emacs buffer
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Damien Garaud
# Date: 2014-2015
# License: Simplified BSD
"""Allow you to pipe command results into an Emacs buffer. Suppose you have an
Emacs server since you launch 'emacsclient'.
@fstamour
fstamour / org-mode-reference-in.org
Created April 22, 2021 12:51 — forked from drj42/org-mode-reference-in.org
This is a cheat sheet for Emacs org-mode... in org-mode format!
@fstamour
fstamour / 55-bytes-of-css.md
Created September 29, 2022 08:39 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@fstamour
fstamour / terminal.txt
Created December 26, 2022 04:19 — forked from ma11hew28/terminal.txt
Unique Unordered Pairing Function
$ ruby unique-unordered-pairing-function.rb
Cantor Pairing Function
-----------------------
<x, y> = (x + y) * (x + y + 1) / 2 + y
0 1 2 3 4 5 6 7 8 9 10 11 12 13
+ ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— + ——— +
0 | 0 | 1 | 3 | 6 | 10 | 15 | 21 | 28 | 36 | 45 | 55 | 66 | 78 | 91 |
@fstamour
fstamour / make-sbql.sh
Created December 30, 2022 03:35 — forked from glider-gun/make-sbql.sh
dump sbcl core with quicklisp (and some packages) preloaded (this is created before I use roswell)
#!/bin/sh
OUTPUT="sbql"
PRELOADS="alexandria cl-ppcre local-time cffi cl-interpol"
PREUSES="split-sequence anaphora iterate"
# sbcl --script <<EOF
sbcl --no-sysinit --no-userinit --noprint <<EOF
;; load quicklisp (from .sbclrc content added when quicklisp installation)
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
@fstamour
fstamour / freeotp_backup.md
Created February 7, 2023 14:51 — forked from jleclanche/freeotp_backup.md
A guide to back up and recover 2FA tokens from FreeOTP (Android)

Backing up and recovering 2FA tokens from FreeOTP

Backing up FreeOTP

Using adb, create a backup of the app using the following command:

adb backup -f freeotp-backup.ab -apk org.fedorahosted.freeotp
@fstamour
fstamour / fizzbuzz.c
Created July 12, 2024 04:07 — forked from anonymous/fizzbuzz.c
A FizzBuzz program. Somehow. I don't know why it works.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gmp.h>
char * polynomial="-74101463560860539810482394216134472786413399/404009590666424903383979388988167534591844018460526499864038804741201731572423877094984692537474105135297393596654648304117684895744000000000000000000000*x^99 + 1786563401621773217421750502452955853226339781/1943688752347061390850759947022111850270039951356484879070977067483444756705819339975871373032521468004867185688372878439054154137600000000000000000000*x^98 - 27321291157050372775340569532625689973429185264741/12024094960310264981666053243695462339042976739896622019763059664916718201560234437350734896948634081407660523709959770955883479040000000000000000000000*x^97 + 4936870031754926645682423836151042176171669450909/1336493173680525187613977630110369004256312194947800263402124063124652591386915768177479078216982141485276408003996973457735680000000000000000000000*x^96 - 24473118674386691114350902920738421254018653211816783/55093218603941649400531744530105211175454647
-- from https://gist.github.com/anonymous/83b1f8d2da6ee35d172b
import Data.Bits ((.&.), shiftR)
import Data.Char (chr)
import Data.Ratio ((%), Ratio, numerator)
import Data.Word (Word32)
poly :: Ratio Integer -> Ratio Integer
poly x =
- 74101463560860539810482394216134472786413399%404009590666424903383979388988167534591844018460526499864038804741201731572423877094984692537474105135297393596654648304117684895744000000000000000000000*x^99