Skip to content

Instantly share code, notes, and snippets.

View chmduquesne's full-sized avatar

Christophe-Marie Duquesne chmduquesne

View GitHub Profile
@chmduquesne
chmduquesne / ansible-role-test.sh
Last active January 16, 2020 16:22 — forked from geerlingguy/ansible-role-test.sh
Ansible Role Test Shim Script
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - role_dir: the directory where the role exists (default = $PWD)
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
@chmduquesne
chmduquesne / Makefile
Created March 27, 2019 22:54
gpg maintenance
ifdef GNUPGHOME
CONF := ${GNUPGHOME}/gpg.conf
else
CONF := ~/.gnupg/gpg.conf
endif
DEFAULTKEY = $(shell gpg -K --with-colons | grep "^sec" | cut -d: -f5 | tail -n1)
DEFAULTFPR = $(shell gpg -K --with-colons | grep "^fpr" | grep $(DEFAULTKEY) | rev | cut -d: -f2 | rev)
export:

Keybase proof

I hereby claim:

  • I am chmduquesne on github.
  • I am chmd (https://keybase.io/chmd) on keybase.
  • I have a public key ASBRbau_IRSvogONp4F67GQX416mAQE-2yaAbEyZ_jznfQo

To claim this, I am signing this object:

@chmduquesne
chmduquesne / dtach_manager
Created January 22, 2019 12:20
dtach_manager
#!/bin/bash
[ -n "$DTACH" ] && exit
DTACHDIR=$HOME/.dtach
[ ! -d "$DTACHDIR" ] && mkdir -p "$DTACHDIR"
pick_session(){
[ -n "$(ls -1 $DTACHDIR)" ] && ls -1 $DTACHDIR | pick
}
@chmduquesne
chmduquesne / read_ahead_test.py
Last active December 16, 2015 12:40
Testing the read ahead feature of mq in python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pymqi
import pymqi.CMQC as CMQC
import time
import sys
import os
from os import getenv
import signal
import logging
@chmduquesne
chmduquesne / irssi-sqlitify.py
Last active February 20, 2024 17:39
Put irssi logs in sqlite
#!env python
"""
Script to load irssi logs into a sqlite database.
This script assumes the following irssi log config:
autolog = "Yes";
autolog_path = "~/.irssi/logs/$tag/$0.log";
Launch it without argument. It will create or update the file irssi.db
in the current directory. Each channel is loaded into a table, and each
row within this table has 4 fields:
@chmduquesne
chmduquesne / ola.py
Created June 22, 2012 14:12 — forked from brunobord/ola.py
Olà in Python / ASCII art
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import time
import random
ncols = 26
nrows = 20
def cls():