Skip to content

Instantly share code, notes, and snippets.

View flusher's full-sized avatar

Florian Cathala flusher

View GitHub Profile
@flusher
flusher / absolute_to_relative_menu_items.sql
Created April 18, 2023 14:03
Massively convert absolute links to relative links with in menu items in Drupal 8+ (SQL)
View absolute_to_relative_menu_items.sql
UPDATE menu_link_content_data SET rediscover=1,changed=unix_timestamp(),link__uri = REPLACE(link__uri, 'https://www.example.com', 'internal:');
UPDATE menu_link_content_field_revision SET changed=unix_timestamp(),link__uri = REPLACE(link__uri, 'https://www.example.com', 'internal:');
# /!\ Do not forget to clear cache (drush cr) !
@flusher
flusher / mount_partition_from_block_image.txt
Created February 10, 2023 09:51
Mount a partition from a block dd-generated disk image
View mount_partition_from_block_image.txt
losetup --partscan --find --show disk.img
mount /dev/loop0p1 /mnt
@flusher
flusher / drupal8.md
Created April 21, 2022 11:10 — forked from UshaMakoa/drupal8.md
drupal d8
View drupal8.md
View gist:1a733513218599266fb218fb5e7e0417
Host *
Compression yes
KeepAlive yes
ServerAliveInterval 10
GSSAPIAuthentication no
AddKeysToAgent yes
AddressFamily inet
ServerAliveInterval 300
ServerAliveCountMax 2
ControlPersist 600
@flusher
flusher / letsencrypt.conf
Created February 17, 2017 10:46
Nginx Letsencrypt perfect configuration
View letsencrypt.conf
# Rule for legitimate ACME Challenge requests (like /.well-known/acme-challenge/xxxxxxxxx)
# We use ^~ here, so that we don't check other regexes (for speed-up). We actually MUST cancel
# other regex checks, because in our other config files have regex rule that denies access to files with dotted names.
location ^~ /.well-known/acme-challenge/ {
# Prevent HTTP Auth
auth_basic off;
allow all;
# Separate logs
View deploy_myproject_drupal.sh
#!/bin/bash
# Script de déploiement pour un projet Drupal versionné sur un repo Git
# avec gestion des releases et des sauvegardes.
APP_ENVIRONNEMENT="PROD"
APP_PATH="/var/www/www.myproject.com"
APP_CURRENT_PATH="current"
APP_RELEASES_PATH="releases"
APP_BACKUP_PATH="backup"
@flusher
flusher / deploy_myproject_tag.sh
Created May 25, 2016 13:31
Deployment script for a given (git, versioned Drupal project) tag
View deploy_myproject_tag.sh
#!/bin/bash
#########################
### Deployment script ###
#########################
APP_PATH="/var/www/myproject/www"
APP_URL="www.myproject.com"
APP_POST_DEPLOY_SCRIPT="$APP_PATH/scripts/myproject_update.sh"
@flusher
flusher / cve-2015-0235_vulntest.c
Created January 27, 2015 17:48
CVE-2015-0235 vulnerability test
View cve-2015-0235_vulntest.c
/* [user@fedora-19 ~]$ cat > charged-ghbn.c << EOF */
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define CANARY "in_the_coal_mine"
struct {
@flusher
flusher / makeiso.sh
Last active August 29, 2015 14:01
Create FreeDOS bootable ISO from FDOS OEM CD builder
View makeiso.sh
#!/bin/bash
# Create FreeDOS bootable ISO from FDOS OEM CD builder
# @see http://www.fdos.org/bootdisks
mkisofs -o fdoem.iso -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -N -J -r -c _$ -hide-joliet _$ -hide _$ CDROOT
@flusher
flusher / freedos pxe boot
Created May 6, 2014 10:47
Boot FreeDOS iso through PXE
View freedos pxe boot
label freedos
menu label ^FreeDOS
kernel path/memdisk
initrd path/freedos.iso
append iso raw