Skip to content

Instantly share code, notes, and snippets.

View Pierstoval's full-sized avatar
🌖

Alex Rock Pierstoval

🌖
View GitHub Profile
@Pierstoval
Pierstoval / git-squash
Last active August 29, 2015 14:19
Git squash extension. Put this file on /usr/local/share/git-squash/git-squash on most unix distribs
#!/bin/bash
# Author: Joel Nothman
# Optimized by Pierstoval
# Under BSD-2 license
# See https://github.com/jnothman/git-squash
# See https://github.com/Pierstoval/git-squash
usage() {
echo ""
echo Usage: git squash '[-m <commit msg>] [-a|--append] [-f|--full] <base>'
@Pierstoval
Pierstoval / pre-receive.bash
Last active September 9, 2021 07:46
Git pre-receive example to use a bare repo to deploy an ap
#!/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,
@Pierstoval
Pierstoval / imagemagick_geometry.php
Last active January 9, 2020 15:24
This enormous regexp matches any "Geometry" parameter for ImageMagick. See the docs about this: http://www.imagemagick.org/script/command-line-processing.php#geometry
<?php
$number = "\d*(?:\.\d+)?"; // It's a reference to use in other cases that matches any kind of number/float
$width = "(?<w>(?:$number)?%?)?"; // This is the first part, the width
$height = "(?:x(?<h>(?:$number)?%?))?"; // Here is the height, the same as "width" but starting with an "x"
$aspect = "[!><@^]"; // These are the different filters one can use to stretch, shrink, etc.
$size = "$width$height"; // To match any size we need width and height at least (aspect comes later)
@Pierstoval
Pierstoval / FluxRssSuivis.md
Last active March 20, 2017 06:58
Flux RSS suivis avec le plugin "Feeder"
@Pierstoval
Pierstoval / keybase.md
Last active April 21, 2019 19:44
keybase.md

Keybase proof

I hereby claim:

  • I am pierstoval on github.
  • I am pierstoval (https://keybase.io/pierstoval) on keybase.
  • I have a public key ASDMqGJzpJ2OMQa9tDDwznVYnbzPVW7K4oDlKUBliBawWAo

To claim this, I am signing this object:

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
@Pierstoval
Pierstoval / _ChromeSnippets.md
Last active August 8, 2019 15:14
Chrome snippets

My Chrome snippets

@Pierstoval
Pierstoval / devices.php
Last active August 18, 2017 11:20
See the size of your website on most famous devices
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
* { margin: 0; padding: 0; box-sizing: border-box; }
iframe {
overflow: hidden;
border: solid 1px black;

Git gc script to save space

Place this at the "root" of your git repos, or even your projects directory.

Like /var/www/git_gc.bash for example, if you save many projects under this dir.

This script will run git reflog expire and git gc with extra options to save some space when working with heavy & often rebased projects.

@Pierstoval
Pierstoval / _PHP is_a() vs is_subclass_of().md
Last active March 1, 2023 13:02
`is_a()` vs `is_subclass_of()`

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