Skip to content

Instantly share code, notes, and snippets.

axeleroy / .htaccess
Last active Mar 29, 2018
Force HTTPS on Wordpress sites
View .htaccess
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.domain.tld/$1 [R,L]
# Replace domain.tld by you own domain name ;-)
# BEGIN WordPress
axeleroy / sshrc
Last active Oct 2, 2019
Send Pushbullet notification on SSH connection
View sshrc
access_token=<pushbullet access token> # Get it from your account settings page (
# Get IP, reverse DNS and hostname
reverse=$(dig -x $ip +short)
curl --request POST \
axeleroy / markdown-img-picture-replacement.rb
Created May 29, 2020
Jekyll plugin that replaces pictures in Markdown documents by responsive images using jekyll-responsive-mage
View markdown-img-picture-replacement.rb
Jekyll::Hooks.register :documents, :pre_render do |document, payload|
docExt ='.', '')
# only process if we deal with a markdown file
if payload['site']['markdown_ext'].include? docExt
newContent = document.content.gsub(/!\[(.*)\]\((?:\/?([^\)\:\s]+))(?:\s"(.*)")?\)(?:{:([^}]+)})*/, '{% responsive_image path: \2 alt: "\1" title: "\3" %}')
document.content = newContent
axeleroy /
Created Apr 19, 2020
Python library for generating WXR files
"""Utility functions to create a WXR file for Wordpress.
import datetime
import os
from lxml import etree as ET
from lxml.etree import CDATA
# XML namespaces declarations