Skip to content

Instantly share code, notes, and snippets.

Fabien Arcellier FabienArcellier

  • Octo Technology
  • Paris
Block or report user

Report or block FabienArcellier

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@FabienArcellier
FabienArcellier / system.py
Last active May 17, 2018
template to use python as command engine as you would use bash -ex
View system.py
#!/usr/bin/env python
import os
import sys
SCRIPT_DIR = os.path.realpath(os.path.join(__file__, '..'))
ROOT_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
def main(arguments):
View app.py
#!/usr/bin/python
# coding=utf-8
import os
import tempfile
from subprocess import call
def main():
os.environ["TMPDIR"] = "/home/far/tmp"
print(tempfile.gettempdir())
@FabienArcellier
FabienArcellier / prepare-commit-msg
Last active Dec 27, 2017
Sometime, it's useful to have the last 5 commits to name it's own commit. This hook will add this information in comment at the end of the text editor
View prepare-commit-msg
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
View audit_aws.sh
#!/usr/bin/env bash
readonly SCRIPT_DIR=$(dirname "$(readlink -m "$0")");
function main
{
set -o errexit
set -o pipefail
set -o nounset
set -o errtrace
View loopdir.sh
function loopdir {
command=$*
for d in */ ; do (cd $d; $command); done
}
function loopdirp { ## loop over directory based on a glob pattern loopdirp 'a*' rm deploy.yml
pattern=$1
shift 1
command=$*
for d in $pattern/ ; do (cd $d; $command); done
View bash parallel on multi-file
#!/usr/bin/env bash
readonly SCRIPT_DIR=$(dirname $(readlink -m $0));
function main
{
if [ -z "$1" ] && [ -z "${2}" ]; then
error_exit "Argument Identifiant projet attentu : bash ${0} path"
fi
@FabienArcellier
FabienArcellier / findcode.sh
Created Nov 13, 2015
findcode & display code command
View findcode.sh
function findcode {
extension=$1
pattern=$2
find . -name "*.${extension}" | xargs grep -ni --colour=always ${pattern}
}
# Utility
function displaycode {
file=$(echo $1 | cut -f1 -d:)
@FabienArcellier
FabienArcellier / logstash.conf
Last active Aug 10, 2017
Use ruby object in logstash ruby filter
View logstash.conf
input {
stdin {}
}
filter {
ruby {
init => "load('ruby.rb'); @val=Myclasse.new('value')"
code => "event['method']=@val.value()"
}
}
View check_spa.js
// Check loading of Single Page Application
//
// It checks the count of requests equals the count of response
// of loading of SPA
var page = require('webpage').create();
var system = require('system');
var lastReceived = new Date().getTime();
var requestCount = 0;
@FabienArcellier
FabienArcellier / BotObject.cs
Created Jan 14, 2014
This exemple not working. I try to implement a BOT engine in C# to understand what are good points and negative points. http://www.chris-granger.com/2012/12/11/anatomy-of-a-knockout/
View BotObject.cs
Class Element : BotObject
{
Behavior={":black", ":next_click_white"}
}
class BlackBehavior
{
Trigger = {":click"},
Reaction( (o) => {
System.WriteLine("Noir")
You can’t perform that action at this time.