Skip to content

Instantly share code, notes, and snippets.

View C-Duv's full-sized avatar

Duvergier Claude C-Duv

View GitHub Profile
@C-Duv
C-Duv / commands.sh
Last active February 12, 2020 17:27
Commands to build ipxe files via Docker (using a Debian 10.2 image)
# Path where to work
IPXE_DIRPATH="/opt/ipxe"
# Create some directories
mkdir -p "${IPXE_DIRPATH}/"{ipxe_project,builder}
# Fetch iPXE source files
cd "${IPXE_DIRPATH}/ipxe_project"
git clone https://github.com/ipxe/ipxe.git .
@C-Duv
C-Duv / svn-unexpand_id.sh
Created April 1, 2021 13:32
Unexpand the "svn:id" SVN property ($Id$)
#!/bin/bash
# Unexpand the "svn:id" SVN property ($Id$)
#
# Anywhere the expanded "$Id$" string (eg. "$Id: Foobar.php 42 1970-01-01 00:00:00Z jdoe$")
# is found, it is replaced by "$Id".
# Usefull to quickly compare code file-by-file
DIR="$1"
@C-Duv
C-Duv / extract_shell_from_markdown.php
Created May 27, 2015 22:47
Markdown to Shell conversion
#!/usr/bin/php
<?php
/**
* Script to extract any Shell commands from a Markdown document
*
* It takes a Markdown stream (from STDIN) and only keeps the "```Shell"-blocks content.
* By adding a Shebang first, the ouput is directly executable.
*/
@C-Duv
C-Duv / 0.Notes.md
Created August 1, 2017 23:31
Example for Docker Swarm, Let's Encrypt and Nginx setup with no Nginx down time (answer to https://twitter.com/developius/status/892470102632923136)
@C-Duv
C-Duv / Commented-regex.php
Created August 8, 2022 22:51
Écrire une regex de manière lisible via des commentaires
<?php
// Ajoute le namespace CSS à chaque "début de mot" en gérant le
// fait que les noms de classe peuvent contenir des "-".
// Cela doit être géré de manière particulière car \w = [a-zA-Z0-9_]
preg_replace(
// Partie de RegEx | Correspond à...
// -------------------- | -------------
//(?<!-) | Si ce qui suit n'est pas précédé d'un "-"
@C-Duv
C-Duv / steamdb-bookmarklet.js
Created June 10, 2019 17:22
Bookmarklet to open Steam Database (steamdb.info) page from Steam Store (store.steampowered.com) page
/**
How to use:
1/ Use the following line as the "URL" of a bookmark in your web browser.
2/ Place the bookmark in the bookmark bar for easy access.
3/ When on a steampowered.com page, click on the bookmark and the corresponding steamdb.info page will open.
*/
javascript:(function(){if (window.location.hostname == 'store.steampowered.com') {var pathMatch = window.location.pathname.match(/^\/(?<appType>(app|bundle|sub))\/(?<appId>\d+)\//);pathMatch && window.open('https://steamdb.info/' + pathMatch.groups.appType + '/' + pathMatch.groups.appId + '/?source=bookmarklet','_blank');}})();