Skip to content

Instantly share code, notes, and snippets.

Avatar
🌖

Alex Rock Pierstoval

🌖
View GitHub Profile
@Pierstoval
Pierstoval / confirm.Makefile
Last active Sep 6, 2022
"confirm" action for your Makefile
View confirm.Makefile
# To use the "confirm" target inside another target,
# use the " if $(MAKE) -s confirm ; " syntax.
mycommand:
@if $(MAKE) -s confirm ; then \
execute_your_command_here ; \
fi
.PHONY: mycommand
# The CI environment variable can be set to a non-empty string,
@Pierstoval
Pierstoval / full-reset.Makefile
Last active Sep 6, 2022
Reset your entire application securely from a Makefile
View full-reset.Makefile
#
# When you run "make full-reset", you see a warning message telling you to
# re-run the command with an environment variable if you're sure.
#
# So to *actually* execute the command, you have to run "make -e RESET=1 full-reset".
# Feel free to change the "resetting" scripts as you want.
#
# These are helper vars to use to have a nicer display for messages
_TITLE := "\033[32m[%s]\033[0m %s\n" # Green text
View Acronymes.md

Liste d'acronymes utilisés dans la programmation

Acronyme Définition
Les principes SOLID :
• SRP Single Responsibility Principle
• OCP Open/Closed principle
• LSP Liskov Substitution Principle (un acronyme féministe, du nom de la mathématicienne Barbara Liskov !)
• ISP Interface Segregation Principle (tu vois que ça fait conflit avec "ISP - Internet Service Provider", LAULE)
• DIP Dependency Inversion Principle
View get_sf_contrib_name.ps1
curl --silent "https://symfony.com/doc/current/index.html?$(Get-Random -minimum 0)" | htmlq '.thanks strong:first-child' --text | sed -E 's/ +//g' | php -r "echo trim(file_get_contents('php://stdin'));"
@Pierstoval
Pierstoval / _PHP is_a() vs is_subclass_of().md
Last active Mar 16, 2022
`is_a()` vs `is_subclass_of()`
View _PHP is_a() vs is_subclass_of().md

PHP is_a() vs is_subclass_of()

To compute the results, just use Melody and run the script:

melody run https://gist.github.com/Pierstoval/ed387a09d4a5e76108e60e8a7585ac2d
@Pierstoval
Pierstoval / tauri_dev.mjs
Created Feb 11, 2022
A Node.js script to run both Node frontend & Rust backend when developing with Tauri
View tauri_dev.mjs
import {spawn} from "child_process";
const yarn_path = process.env.npm_execpath;
const node_path = process.env.npm_node_execpath;
const create_process = function(name, args) {
let child = spawn(node_path, [yarn_path, ...args], {stdio: 'inherit'});
child.on('close', (code) => console.log(`child process ${name} exited with code ${code}`));
View PHP_SERVER_ENV_SAFE.txt
pierstoval@PIERSTOVAL /mnt/e/dev/www/sandbox $ ./test.bash
KO for key ALLUSERSPROFILE
KO for key APPDATA
KO for key CLINK_DIR
KO for key CommonProgramFiles
KO for key CommonProgramW6432
KO for key COMPUTERNAME
KO for key ComSpec
KO for key FPS_BROWSER_APP_PROFILE_STRING
View obliterate.Makefile
_TITLE := "\033[32m[%s]\033[0m %s\n"
_ERROR := "\033[31m[%s]\033[0m %s\n"
obliterate:
@printf $(_ERROR) "WARNING" "This will remove EVERYTHING and result into a setup similar to a fresh \"git clone\"."
@printf $(_TITLE) "Project" "Stopping & deleting all containers, volumes, etc."
@docker-compose down --volumes --remove-orphans --rmi all
@Pierstoval
Pierstoval / _template.ott
Last active Dec 5, 2021 — forked from rossant/_template.ott
Convert from Markdown to OpenOffice for Linux Magazine
@Pierstoval
Pierstoval / pre-receive.bash
Last active Sep 9, 2021
Git pre-receive example to use a bare repo to deploy an ap
View pre-receive.bash
#!/bin/bash
########################################################################
################################ README ################################
########################################################################
#
# This script is here to allow the use of "git push prod v1.2.3" commands or similar.
#
# Push a tag to a bare repository having this file as pre-receive hook,
# and you'll be able to deploy directly from command line in your local environment,