Skip to content

Instantly share code, notes, and snippets.

@axeleroy
axeleroy / ublacklist-subscriptions.txt
Last active October 25, 2022 08:25
The blocklists I subscribe to in uBlacklist
https://raw.githubusercontent.com/rjaus/ublacklist-pinterest/main/ublacklist-pinterest.txt
https://raw.githubusercontent.com/h-matsuo/uBlacklist-subscription-for-developer/master/list.txt
https://raw.githubusercontent.com/arosh/ublacklist-stackoverflow-translation/master/uBlacklist.txt
@axeleroy
axeleroy / ublacklist-blocklist.txt
Last active August 10, 2023 08:59
My personnal uBlacklist blocklist that mainly block clones of GitHub issues and StackOverflow posts
*://5.9.10.113/*
*://*.alvinalexander.com/*
*://*.askcodez.com/*
*://*.bountysource.com/*
*://*.codegrepper.com/*
*://*.codota.com/*
*://*.geeksforgeeks.org/*
*://*.gitmemory.com/*
*://*.gitter.im/*
*://*.howtodoinjava.com/*
@axeleroy
axeleroy / markdown-img-picture-replacement.rb
Created May 29, 2020 22:10
Jekyll plugin that replaces pictures in Markdown documents by responsive images using jekyll-responsive-mage
Jekyll::Hooks.register :documents, :pre_render do |document, payload|
docExt = document.extname.tr('.', '')
# 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
end
end
@axeleroy
axeleroy / wxr_utils.py
Created April 19, 2020 18:00
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
@axeleroy
axeleroy / sshrc
Last active October 2, 2019 20:12
Send Pushbullet notification on SSH connection
#!/bin/bash
access_token=<pushbullet access token> # Get it from your account settings page (https://www.pushbullet.com/#settings/account)
# Get IP, reverse DNS and hostname
ip=${SSH_CONNECTION%% *}
reverse=$(dig -x $ip +short)
hostname=$(hostname)
curl --request POST \
@axeleroy
axeleroy / .htaccess
Last active March 29, 2018 13:59
Force HTTPS on Wordpress sites
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