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 / phing-audit.xml
Created September 27, 2012 14:34
Mini audit de code avec phing
<?xml version="1.0" ?>
<project name="audit" basedir="." default="audit">
<property name="style" value="ZEND" />
<property name="test" value="${source}/../test" />
<property name="test-bootstrap" value="" />
<target name="prepare">
<mkdir dir="${out}" />
</target>
@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 / cache-composer.php
Last active February 24, 2020 14:14
This tool generate local cache of your dependencies and install satis server to use it
#!/usr/bin/php
<?php
$cacheDestination = isset($argv[1]) ?$argv[1] : null;
$satisDestination = isset($argv[2]) ?$argv[2] : null;
$composerFile = 'server-satis.json';
if (in_array($cacheDestination, array('--help', null))) {
die(sprintf('Accelerator for composer
This tool generate local cache of your dependencies,
@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
@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 / travis-jenkins-docker.sh
Created May 28, 2014 14:57
.travis.yml avec Jenkins et Docker
#!/bin/bash
EXIT_STATUS=0
echo "#!/bin/bash" > ./docker-travis-test.sh
cat .travis.yml | shyaml get-values before_script >> ./docker-travis-test.sh
cat .travis.yml | shyaml get-values script >> ./docker-travis-test.sh
PHP_VERSIONS=`cat .travis.yml | shyaml get-values php`
for PHP_VERSION in $PHP_VERSIONS
@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));