Skip to content

Instantly share code, notes, and snippets.

View jehanf's full-sized avatar

Jehan Fillat jehanf

View GitHub Profile
@jehanf
jehanf / AddNoFollowExternalLinks.php
Last active February 26, 2019 14:37
Wordpress • Automatically adds No Follow / target='_blank" to all external links in post content / page content
#!/bin/bash
USER="USER_NAME"
PASSWORD="PASSWORD"
#OUTPUT="FOLDER"
#rm "$OUTPUTDIR/*gz" > /dev/null 2>&1
databases=`mysql -u $USER -p$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
@jehanf
jehanf / list-images.sh
Last active March 26, 2021 13:46
Linux : List all images in a folder and print the list in a file
find . -name '*' -exec file {} \; | grep --line-buffered -o -P '^.+: \w+ image' > images.txt
@jehanf
jehanf / Certificat Let's Encrypt sur un Synology avec une Livebox.md
Last active August 5, 2021 11:59
Certificat Let's Encrypt sur un Synology avec une Livebox

1. Administration de la Livebox

Probablement 192.168.1.1

  1. Paramètres avancés (roulette crantée)
    1. Pare-feu Ouverture de ports dans le pare-feu (pour équipements IPv6).
      - Application/Service : Web Server (HTTP)
      - Port : 80
  • Protocole : UDP/TCP (dans le doute)
@jehanf
jehanf / functions.php
Created June 14, 2022 05:16
Quick & dirty way to debug a Cron Task in WordPress
add_action( 'init', function() {
error_reporting( 1 );
do_action( 'your_cron_action' );
} );
@jehanf
jehanf / readme.md
Created July 19, 2023 09:29
Pull image from ghcr.io and have it works with Synology Docker

Enable SSH on Synology DSM

Control Panel => Terminal & SNMP => Terminal => Check "Enable SSH service"
Keep port 22, we will disable SSH at the end for security reason so no need to have some exotic config here

Open a Terminal and SSH onto the Synology

ssh <user>@<synology-ip>
The password is the one you use to log into your NAS (I do hope you have a password!)

Once logged in

sudo -i

@jehanf
jehanf / .htaccess
Created October 17, 2023 10:06
Apache 2.4 conditional htpasswd auth depending on host
<IfModule mod_setenvif.c>
SetEnvIfNoCase ^HOST$ .+ unauthenticated
SetEnvIfNoCase ^HOST$ ^dev\.example\.com$ !unauthenticated
AuthType Basic
AuthName "dev.example.com"
AuthUserFile /path/to/.htpasswd
<RequireAny>
Require env unauthenticated
Require valid-user