Skip to content

Instantly share code, notes, and snippets.

View akerouanton's full-sized avatar

Albin Kerouanton akerouanton

View GitHub Profile
@akerouanton
akerouanton / mumble.sh
Last active December 26, 2015 17:39
Install, configure and test php-zeroc-ice.
#!/bin/bash
if [ `apachectl configtest` != "Syntax OK" ]; then
echo "Veuillez vérifier la configuration de votre serveur apache (apachectl configtest) avant de continuer."
exit 1
fi
apt-get install -y php-zeroc-ice
INSTALLED=`dpkg -s php-zeroc-ice | grep "install ok installed" | wc -l`
#!/usr/bin/env python
from os import listdir,path,remove
from collections import namedtuple
from time import strptime
import datetime
import string
import shutil
BackupRange = namedtuple('BackupRange', ['daily', 'weekly', 'monthly'])
@akerouanton
akerouanton / winusb.sh
Last active August 29, 2015 14:09
Winusb shell script
#!/bin/bash
# Originated from winusb package sources (available in colingille/freshlight ppa's repository)
# Program licensed under GNU GPLv3
# Config
# Le script quitte en cas d'erreur d'une commande
set -o errexit
# Le script quitte en cas de variables non déclarée
<?php
namespace Context;
use Behat\Behat\Context\Context as ContextInterface;
use Behat\Behat\Hook\Scope\AfterScenarioScope;
use Behat\Behat\Hook\Scope\BeforeFeatureScope;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Gherkin\Node\TaggedNodeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@akerouanton
akerouanton / .bash_aliases
Last active February 1, 2016 09:21
Bash macro preventing composer execution with xdebug enabled
COMPOSER_PATH=`which composer`
composer() {
if ! php5query -s cli -m xdebug >/dev/null; then
$COMPOSER_PATH $@
return
fi
# Re-enable xdebug even after a ctrl-c (SIGINT)
# and clear the signal handler
trap 'sudo php5enmod xdebug; trap - INT' INT
{# Variables: php_version, src_dir, packages, php_extensions, pecl_packages, php_ini_configs, php_fpm_configs -#}
FROM php:{{ php_version }}-fpm
# Install packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
{% for package in packages -%}
{{ package }} \
{% endfor -%}
&& \
FROM jenkins:2.3
COPY plugins.txt /usr/share/jenkins/ref/
RUN /usr/local/bin/plugins.sh /usr/share/jenkins/ref/plugins.txt
COPY basic-security.groovy /usr/share/jenkins/ref/init.groovy.d/basic-security.groovy
#!/bin/bash
CONTAINER_NAME=${CONTAINER_NAME:=docker-cleanup}
ps="`docker ps -a --format "{{.Names}}: {{.Status}}" | grep ${CONTAINER_NAME}`"
run_container () {
docker run -d \
--name docker-cleanup \
-v /var/run/docker.sock:/var/run/docker.sock:rw \
-v /var/lib/docker:/var/lib/docker:rw \
@akerouanton
akerouanton / bastion.json
Created June 7, 2016 10:02
Cloudformation, ansible, SSH bastion & rsync
{
/** Should go into roles/your_playbook/files/bastion.json */
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"BastionInstance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"AvailabilityZone": "eu-central-1a",
"ImageId": "ami-ccc021a3",
"InstanceType": "t2.nano",
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1