Skip to content

Instantly share code, notes, and snippets.

View Halleck45's full-sized avatar

Jean-François Lépine Halleck45

View GitHub Profile
@Halleck45
Halleck45 / profiler.sh
Last active August 29, 2015 13:56
Run xdebug tracefile-analyzer on script
#!/bin/bash
# Usage
# ./profiler.sh /path/to/phpfile.php arg1 arg2 ...
if [ ! -f tracefile-analyser.php ]
then
echo get tracefile-analyser
wget https://raw.github.com/derickr/xdebug/master/contrib/tracefile-analyser.php
fi
@Halleck45
Halleck45 / provision-capistrano.sh
Created March 19, 2014 16:36
Jenkins, Gitlab and Capistrano on CentOS 6.5 (64 bits)
#!/bin/bash
# author: Jean-François Lépine
# Ruby
# -----------------------
curl -L get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm reload
rvm install 2.1.0
@Halleck45
Halleck45 / Csrf.php
Created July 28, 2014 09:56
Minimal protection against CRSF exploit without changing any file
<?php
/**
* Class SecurityException
*/
class SecurityException extends Exception {};
/**
* Class Csrf
*
@Halleck45
Halleck45 / licenses-violations.php
Last active August 29, 2015 14:05
Check licenses violations
<?php
// Usage
// composer licenses --format=json > licenses.json
// php analyze.php --file=licenses.json
$options = getopt('', array('file'));
$file = $options['file'];
$json = json_decode(file_get_contents($file));
@Halleck45
Halleck45 / pick-iframe.html
Created December 22, 2014 15:44
pick Jenkins monitor table
<iframe id="frame-monitor" style="display:none; " src="http://jenkins.xxxx.fr/view/Administration/job/Administration%20-%20Monitoring/2/sitemonitor/"></iframe>
<div id="div-monitor"></div>
<script type="text/javascript">
var iframe = document.getElementById('frame-monitor');
iframe.onload = function() {
var innerDoc = (iframe.contentDocument) ? iframe.contentDocument : iframe.contentWindow.document;
var table = innerDoc.getElementById('files');
var container = document.getElementById('div-monitor');
container.appendChild (table);
iframe.parentNode.removeChild( iframe );
@Halleck45
Halleck45 / css-stats-ack.sh
Created September 28, 2012 18:19 — forked from pjkix/css-stats-ack.sh
shell script to generate some css file statistics
#!/bin/bash
## v1.0.6
## this script will gernerate css stats
### example output
# CSS STATS
# ----------
# Floats: 132
@Halleck45
Halleck45 / memory-trigger.php
Created October 2, 2012 14:53
Déclenche un événement quand mémoire > x ou mémoire < y
#!/usr/bin/php -q
<?php
ini_set('display_errors', 1);
function get_memory() {
foreach (file('/proc/meminfo') as $ri) {
$m[strtok($ri, ':')] = strtok('');
}
return 100 - round(($m['MemFree'] + $m['Buffers'] + $m['Cached']) / $m['MemTotal'] * 100);
}
@Halleck45
Halleck45 / process.md
Last active November 28, 2015 13:04
Github migration results

## Steps

  • Creation of Halleck45/tmp-migration

  • Creation of README.md with

    # tmp-migration
    fgh
    
@Halleck45
Halleck45 / phpmetrics.js
Last active December 1, 2015 12:29 — forked from devosc/phpmetrics.js
//http://slimerjs.org/
var page = require('webpage').create();
page.viewportSize = { width:1280, height:800 };
page.open('http://localhost/phpmetrics.html')
.then(function(){
window.setTimeout(function() {
@Halleck45
Halleck45 / behat.yml
Created July 30, 2013 14:01
ex de config behat
default:
paths:
features: ../src/Hal/Manage/Crm/UiApi/Features/
bootstrap: %behat.paths.features%/Context
extensions:
Behat\MinkExtension\Extension:
base_url: http://dev.manage