This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
# ==================================================================================================== | |
# The script below allows to check automatically a commit message before saving it. | |
# In order to use it, you have to copy this code in .git/hooks/commit-msg inside your project. | |
# Don't forget to add proper permissions if you create a new file (chmod +x). Bash 3+ is required. | |
# ==================================================================================================== | |
COMMIT_MSG=$(cat $1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract MySQL data | |
docker run --rm --volumes-from XXXXX -v $(pwd):/backup busybox sh -c "tar cvf /backup/backup.tar /var/lib/mysql" | |
# Restore MySQL data | |
docker run --rm --volumes-from XXXXX -v $(pwd):/backup busybox sh -c "tar xvf /backup/backup.tar var/lib/mysql/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
In the code below, "form_validation" is a JavaScript function provided by a third-party component. This function validates | |
and then sends the form values. Since these two behaviors are linked, it's impossible to only validate the form in this state. | |
But we can update the function without overwriting the whole code. | |
*/ | |
if (typeof form_validation === 'function') { | |
var definition = form_validation.toString() | |
.replace(/myForm\.submit\(\);?/, 'return true;'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<script type='text/javascript'> | |
window.onload = function () { | |
var video = document.getElementById('videoId'); | |
var canvas = document.getElementById('canvasId'); | |
var img = document.getElementById('imgId'); | |
video.addEventListener('play', function () { | |
canvas.style.display = 'none'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ==================================================================================================== | |
# The script below allows to have a quick overview of contributions on a Git repository. Bash 4+ is required. | |
# Especially useful when we do not have access to graphs like those that we can find on Github. | |
# | |
# This script handles three non-mandatory parameters: | |
# - START is used to keep commits only since the given date (default = 01 Jan 2000). | |
# - END is used to keep commits only until the given date (default = 01 Jan 2050). | |
# - MINIMUM is used to define the minimum number of commits in order to appear in the report (default = 10). |