Skip to content

Instantly share code, notes, and snippets.

View CaporalDead's full-sized avatar

Thomas Sieffert CaporalDead

View GitHub Profile
@CaporalDead
CaporalDead / ticket.html
Last active February 22, 2021 19:10
Ticket CSS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
body {
font-family: sans-serif;
background-color: #fff;
color: #535353;
margin: 5px;
@CaporalDead
CaporalDead / Form.js
Created February 2, 2016 15:24
Pour gérer les formulaires en ajax avec gestion des uploads et des confirm
export default class Form {
constructor($form) {
this.$form = $form;
}
/**
* Ajoute le comportement "submit" au(x) formulaire(s)
*
* @param successHandler
* @param failureHandler
@CaporalDead
CaporalDead / update-nginx
Last active November 3, 2016 14:21
A script to auto update your nginx proxy for your docker containers
#!/bin/sh
MAPPING_FILE=$1
CONTAINERS=($(docker ps | awk 'NR>1' | perl -ne '@cols = split /\s{2,}/, $_; printf "%30s %20s %20s\n", $cols[6], $cols[0]' | awk '{print $1":"$2}'))
readarray DOMAINS < $MAPPING_FILE
NGINX_CONF_FILE=/etc/nginx/sites-enabled/auto-update
function getIPByName {
local NAME=$1
@CaporalDead
CaporalDead / api_limit.filter.php
Created October 27, 2014 20:23
Api limit with Laravel
<?php
Route::filter('api.limit', function() {
$key = sprintf('api:%s', Auth::user()->api_key);
// On crée le cache
apc_add($key, 0, 60 * 60);
// On incrément l'appel de 1
$count = apc_inc($key);
@CaporalDead
CaporalDead / create-domain
Created September 8, 2013 02:33
Création d'un nouveau domaine (site hébergé) basé sur son nom de domaine
#!/bin/sh
# /usr/local/bin/create-domain
if [ -z "$1" ]; then
echo "First parameter must be a domain name"
exit 1
fi
DOMAIN_NAME=$1
@CaporalDead
CaporalDead / create-cert
Created September 8, 2013 02:30
Création d'un certificat auto signé pour un domaine donné
#!/bin/sh
#/usr/local/bin/create-cert
if [ -z "$1" ]; then
echo "First parameter must be a domain"
exit 1
fi
DOMAIN=$1
DIRECTORY=/data/www/$DOMAIN/ssl
@CaporalDead
CaporalDead / create-repo
Created September 8, 2013 02:29
Création d'un dépôt SVN pour un domaine donné
#!/bin/sh
#/usr/local/bin/create-repo
if [ -z "$1" ]; then
echo "First parameter must be a project name"
exit 1
fi
if [ -z "$2" ]; then
echo "Second parameter must be a common project name"
@CaporalDead
CaporalDead / backupSVN.sh
Last active December 22, 2015 13:48
Backup de tous les projets SVN
#!/bin/sh
#/scripts/backupSVN.sh
jour=$(LANG=C date +%A | tr A-Z a-z)
motifsvn="/data/www/*/svn/*"
backupdir="/backup"
### ##### ###
if [ ! -d "$backupdir/$jour" ]; then
@CaporalDead
CaporalDead / Logger.php
Last active December 20, 2015 19:38
Simple Static Logger
<?php
namespace Utils;
class Logger
{
const DEBUG = 1;
const INFO = 2;
const ERROR = 3;
const WARNING = 4;