Skip to content

Instantly share code, notes, and snippets.

View dimitri's full-sized avatar

Dimitri Fontaine dimitri

View GitHub Profile
@dimitri
dimitri / Dockerfile
Created December 22, 2021 13:36
pg_auto_failover debian packaging build scripts
FROM debian:sid
ENV TAR v1.6.3.tar.gz
ENV ORIG pg-auto-failover_1.6.3.orig.tar.gz
ENV WORKDIR /usr/src/pg_auto_failover-1.6.3
ENV ARCHIVE https://github.com/citusdata/pg_auto_failover/archive/refs/tags/
ENV RELEASE ${ARCHIVE}${TAR}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
@dimitri
dimitri / minesweeper.asd
Last active November 27, 2018 14:42
A first attempt at McCLIM.
;;;; minesweeper.asd
(asdf:defsystem "minesweeper"
:serial t
:description "A quick minesweeper game using McCLIM"
:author "Dimitri Fontaine <[email protected]>"
:license "ISC"
:depends-on (#:mcclim)
:components ((:file "minesweeper")))
;;;
;;; See https://www.hackerrank.com/challenges/manasa-and-stones
;;;
(defpackage #:manasa-and-stones
(:use :cl))
(in-package #:manasa-and-stones)
(defvar *sample-input* "2
;; see http://www.fogcreek.com/Jobs/SupportEngineer/
(defpackage #:fogcreek
(:use #:cl)
(:export #:*chars*
#:*text*
#:count-chars
#:sort-chars-by-count
#:solve))

Keybase proof

I hereby claim:

  • I am dimitri on github.
  • I am dimitri (https://keybase.io/dimitri) on keybase.
  • I have a public key whose fingerprint is 3AD9 18E6 38A0 3C53 0877 967F F4E0 FE75 60B1 CB4E

To claim this, I am signing this object:

@dimitri
dimitri / xlog-diff.lisp
Created August 20, 2013 20:14
compute lag between two XLOG file names in terms of files and bytes
#! /usr/bin/env sbcl --script
;; compute lag between two XLOG file names in terms of files and bytes
(defparameter *xlog-seg-size* (* 16 1024 1024)
"Xlog segment size, as per PostgreSQL pg_config.h")
(defparameter *xlog-segments-per-xlog-id* 254
"How many Xlog segments we find per xlog ID (00 and FF are skipped)")
@dimitri
dimitri / gist:6031799
Last active July 27, 2020 13:12
Emacs Workshop for first time users discovering Emacs, file in org-mode format.
* An Emacs Workshop for Beginners
It's all about discovering Emacs Really
** Install
*** Emacs 24.3
http://emacsformacosx.com/
http://emacs.naquadah.org/
http://ftp.gnu.org/pub/gnu/emacs/windows/
** Conventions and docs
@dimitri
dimitri / xlog-diff.py
Created March 14, 2013 17:21
compute lag between two XLOG file names in terms of files and bytes
#! /usr/bin/env python
import os, sys
# compute lag between two XLOG file names in terms of files and bytes
# given 000000010000DAD7000000C4 and 000000010000DB1E00000032 we have:
# (int('DB1E',16) - int('DAD7', 16)) * 254 - int('C4',16) + int('132', 16)
#
# in pgsql:src/include/access/xlog_internal.h we have
#
@dimitri
dimitri / move_queues.py
Created April 25, 2012 15:32
PGQ queue forwarding
#! /usr/bin/env python
"""
This script is used to forward events from source queues to
destination queue. Source and destination queues must be named
the same. The script applies to as many source databases as
needed. It allows for consuming all events from a distributed
system (think plproxy nodes) from a single federated queue
installed on the destination database.
@dimitri
dimitri / fizzbuzz.el
Created March 4, 2012 21:17
FizzBuzz, in Emacs Lisp
;;; fizzbuzz.el --- FizzBuzz in Emacs Lisp
;;;
;;; Copyright 2012 Dimitri Fontaine
;;
;; This is using a simple trick: we build a list of entries then print them as-is,
;; so that we can manually add \n when necessary and append "fizz" and "buzz" on the
;; same line.
;;
;; This file has two implementations of fizzbuzz then a main routine (interactive) to
;; call to fill in a buffer. Try loading the file then M-x fizzbuzz.