Skip to content

Instantly share code, notes, and snippets.

View GregoireHebert's full-sized avatar
:octocat:
Probably somewhere sipping a beer

Grégoire Hébert GregoireHebert

:octocat:
Probably somewhere sipping a beer
View GitHub Profile
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="Pong">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pong</title>
<style type="text/css">
canvas { background-color: black; }
@GregoireHebert
GregoireHebert / fougere.html
Last active November 21, 2018 22:44
La fougère de Barnsley
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="la fougère de Barnsley">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Fougère de Barnsley</title>
</head>
<body>
<canvas id="fougere" width="600" height="600"></canvas>
@GregoireHebert
GregoireHebert / DotenvUpdater
Last active November 6, 2018 17:14
DotenvUpdater
#!/usr/bin/env php
<?php
declare(strict_types=1);
foreach ([__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php'] as $file) {
if (file_exists($file)) {
require $file; break;
}
}
@GregoireHebert
GregoireHebert / create_gitlab_project.sh
Last active August 2, 2016 12:58
Script to create a virtualhost + directory + gitlab project + capistrano deployement + webhook
#!/bin/bash
# create_gitlab_project.sh
# create_gitlab_project.sh: shell script that create a virtualhost + directory + gitlab project + capistrano deployement + webhook.
# The MIT License (MIT)
# Copyright (C) 2015 Grégoire Hébert http://www.gheb.fr
# Permission is hereby granted, free of charge, to any person obtaining a copy
@GregoireHebert
GregoireHebert / icsGenerator.php
Last active December 30, 2015 05:59
Méthode de génération de l'identifiant créditeur SEPA
/**
* Génère l'identifiant créditeur SEPA à partir du Numéro National Emetteur à partir de la méthode de calcul de l'EPC (http://www.europeanpaymentscouncil.eu/content.cfm?page=sepa_direct_debit_%28sdd%29).<br/>
* Les identifiants Créditeurs SEPA sont attribué par la banque de france. Seuls les créditeurs ayant un compte dans une banque française
* peut faire la demande d'un identifiant de créditeur. La demande doit être faite auprès de la banque de france par l'établissement bancaire du créditeur.
* Cet établissement doit avoir un accord avec le conseil européen des paiements.
* (France métropolitaine, Guyane Française, Guadeloupe, Martinique, Mayotte, Réunion, Saint Barthélemy, Saint Martin, Saint Pierre et Miquelon)
* @param string $numero_national_emetteur Identifiant de l'émetteur sur maximum 27 caratères. Est composé de caractères alphanumériques.
* @param string $pays Identifiant du pays au format iso. (http://www.iso.org/iso/fr/french_country_names_and_code_elements.htm) (par défa
@GregoireHebert
GregoireHebert / mysqlsesslock
Created November 25, 2013 20:40
Custom handler, mysql, one row per session, with a mysql advisory lock per session and per var. the "standard" session handler one would write to store session data in a MySQL database. Each row stores the data for one session, the serialized session data is stored in a field of type text. Before the session is read, a mysql advisory lock is acq…
<?php
/* ------------------------------------------------------------------------
* session_mysql.php
* ------------------------------------------------------------------------
* PHP4 MySQL Session Handler
* Version 1.00
* by Ying Zhang (ying@zippydesign.com)
* Last Modified: May 21 2000
* Modified in 2006 by Andy Bakun (abakun ! thwartedefforts , org) to
@GregoireHebert
GregoireHebert / recap.txt
Created November 5, 2015 10:17
Récapitulatif du script de création de projet
Cet outil va réaliser les opérations suivantes :
1) Création d'un répertoire http
2) Ajout d'un virtualhost
3) Création d'un nouveau projet sur GITLAB
4) Initialiser le dépôt
5) Configurer le déploiement automatique
6) Déployer le projet une première fois
@GregoireHebert
GregoireHebert / import-export-mongo.sh
Last active August 31, 2015 16:33
Import export script for mongo
#!/bin/bash
LOADING=false
usage()
{
cat << EOF
usage: $0 [options] dbname
OPTIONS:
@GregoireHebert
GregoireHebert / .bashrc
Created August 5, 2015 10:01
Custom ~/.bashrc with some aliases
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
<?php
// Security permissions:
$writePost = 1;
$readPost = 2;
$deletePost = 4;
$addUser = 8;
$deleteUser = 16;
// User groups: