Skip to content

Instantly share code, notes, and snippets.

View breard-r's full-sized avatar
🦀
Rewrite it in Rust

Rodolphe Bréard breard-r

🦀
Rewrite it in Rust
View GitHub Profile
@breard-r
breard-r / pdns_hash_password.py
Created May 27, 2023 17:07
Replacement script for the `pdnsutil hash-password` command
#!/usr/bin/env python3
#
# Replacement script for the `pdnsutil hash-password` command
#
from base64 import b64encode
from getpass import getpass
from hashlib import scrypt
from os import urandom
from sys import argv
@breard-r
breard-r / lettre.html
Last active November 8, 2020 17:50
Lettre type au format A4 rédigée en HTML
<!doctype html>
<!--
Usage: weasyprint lettre.html lettre.pdf
-->
<html lang="fr">
<head>
<meta charset="utf-8">
<title></title>
<style>
@charset "UTF-8";
@breard-r
breard-r / README.txt
Last active March 7, 2023 22:55
Curriculum vitæ - Python/Jinja2/WeasyPrint
1. Install dependencies
wget 'https://use.fontawesome.com/releases/v5.9.0/fontawesome-free-5.9.0-web.zip'
unzip fontawesome-free-5.9.0-web.zip
rm fontawesome-free-5.9.0-web.zip
pipenv install jinja2
pipenv install weasyprint
2. Edit content.py
3. Generate the PDF
cargo tree --no-indent | cut -d ' ' -f1,2 | sed 's/ v/-/' | sort | uniq | while read -r name ; do size=$(stat --printf="%s" "$(find "$HOME/.cargo/registry/cache/" -mindepth 1 -maxdepth 1 -print)/$name.crate"); printf "%07d %s\n" "$size" "$name"; done | sort
@breard-r
breard-r / dovecot.sieve
Created September 10, 2016 09:48
pluck spam
require ["fileinto", "imapflags"];
if header :contains "sender" "pluckhq.com" {
setflag "\\Seen";
fileinto "Junk";
}
@breard-r
breard-r / .gitignore
Last active August 29, 2015 14:23
Keeps files along with their GPG-encrypted copy.
# Ignore everything except .gpg files
# Useful when you want to sync encrypted files only.
*
!*.gpg
!*/
@breard-r
breard-r / django_locales.sh
Created January 19, 2015 19:10
Inline locale generation for a Django project
for dir in $(find ./ -maxdepth 1 -mindepth 1 -type d -not -path '*/\.*'); do if [ -d "$dir/locale" ]; then cd "$dir"; django-admin.py compilemessages; cd ..; fi; done
@breard-r
breard-r / pre-commit.sh
Last active July 25, 2016 14:20
PEP8 compliance pre-commit git hook
#!/bin/sh
# Inline version:
# find . -wholename "./*/migrations" -prune -o -wholename "./docs/*" -prune -o -name "*\.py" -exec pep8 {} \;
final_exit=0
for file in $(find . -wholename "./*/migrations" -prune -o -wholename "./docs/*" -prune -o -name "*\.py" -print); do
pep8 "$file"
if [ $? -ne 0 ]; then
final_exit=1
fi
@breard-r
breard-r / octopress2pelican.py
Last active August 29, 2015 14:05
Helper script to migrate blog posts from octopress to pelican.
#!/bin/env python
##
## Copyright (c) 2014 Rodolphe Breard
##
## Permission to use, copy, modify, and/or distribute this software for any
## purpose with or without fee is hereby granted, provided that the above
## copyright notice and this permission notice appear in all copies.
##
## THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
## WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF