Skip to content

Instantly share code, notes, and snippets.


Damien Cassou DamienCassou

  • finsit @ Wolters Kluwer
  • Brest, France
View GitHub Profile
DamienCassou / configuration.nix
Created May 29, 2016
systemd user service for Emacs daemon defined in NixOS
View configuration.nix
{ = {
description = "Emacs: the extensible, self-documenting text editor";
serviceConfig = {
Type = "forking";
# ExecStart = "${bigEmacs}/bin/emacs --daemon";
# Running Emacs this way ensures environment variable are accessible:
ExecStart = "${pkgs.bash}/bin/bash -c 'source ${}; exec ${bigEmacs}/bin/emacs --daemon'";
ExecStop = "${bigEmacs}/bin/emacsclient --eval (kill-emacs)";
DamienCassou / configuration.nix
Created Oct 22, 2014
configuration.nix file for NixOS on my macbook pro
View configuration.nix
{ config, pkgs, ... }:
hostname = "luz3";
in {
imports =
[ # Include the results of the hardware scan.
# I use VirtualBox to connect to Windows and Linux guests
ledger balance --depth 1 ^Equity:Budget ^Budget \
| tail -n 1 \
| grep --quiet "^ *0 *$"
DamienCassou / screencasting.el
Created Oct 14, 2019
Record audio, video and keystrokes simulatenously
View screencasting.el
;;; screencasting.el --- Tooling for screencasting -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Damien Cassou
;; Author: Damien Cassou <>
;; Keywords:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
DamienCassou / auto-encrypt-mail.el
Last active Mar 27, 2018
Automatically encrypt Emacs outgoing emails if there is a public key for every recipient
View auto-encrypt-mail.el
(defun my/can-encrypt-message-p ()
"Return non-nil if current message can be encrypted.
I.e., the keyring has a public key for each recipient."
(let ((recipients (seq-map #'cadr ; only take email address, not recipient name
(seq-mapcat (lambda (header)
(let ((header-value (message-fetch-field header)))
(mail-extract-address-components header-value t))))
'("To" "CC" "BCC"))))
DamienCassou / magit-jira.el
Created Dec 20, 2016
magit branch name from jira
View magit-jira.el
(defvar ftgp-jira-summary-url
"Format string to get the summary of a ticket.")
(defcustom ftgp-atlassian-pass-entry "ftgp/"
"Password-store entry where to find FTGP Atlassian credentials.
Must contain both the password and username such that
`auth-pass-get' will find them."
:group 'ftgp
:type 'string)
DamienCassou /
Last active Feb 20, 2016
Emacs-snapshot and emacs24 build script for Ubuntu PPA
#! /usr/bin/env bash
# Author: Damien Cassou
# This is the script I use to build Emacs packages for Ubuntu. These
# packages are uploaded to
# Each package is
# either build from a Debian package or from
#!/usr/bin/env sh
# This script will setup Evm (Emacs Version Manager) and Cask on
# Travis to use for Emacs Lisp testing.
# In .travis.yml, add this:
# - curl -fsSkL > && source ./
# Emacs 24.5 is installed in the above script because Cask requires
DamienCassou / cpython_leaks.cocci
Created May 8, 2012
Coccinelle semantic patch to find misuses of PyDescr_NewMethod with respect to reference counters in cpython
View cpython_leaks.cocci
@r exists@
local idexpression x;
expression e;
position p1,p2;
x = PyDescr_NewMethod@p1(...)
... when != Py_INCREF(x)
when != Py_XINCREF(x)
when != Py_DECREF(x)
View nixos bash functions
function nixos-cleanup-safe () {
df -h /
df -h /
sudo nix-store --optimise
df -h /
function nixos-garbage-add-root () {
sudo ln -s $1 /nix/var/nix/gcroots/