Skip to content

Instantly share code, notes, and snippets.

View evaisse's full-sized avatar

Emmanuel Vaïsse evaisse

  • none
  • Nancy, France
View GitHub Profile
#!/bin/sh
# vmstat_tool.sh
# vmstat parser script. Makes the information easily readable.
# Ensure that the number of loops and delay parameters
# were passed to this script
# examine output with : nohup vmstat_tool.sh 100 > ./vmstat.log &
if [ $# -ne 1 ]
then
echo "Usage: $0 count"
exit
@evaisse
evaisse / HarProxy.java
Last active September 6, 2016 10:07
HAR exporter using selenium webdriver & firefox custom profile using netexport & firebug
import java.io.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
import java.lang.InterruptedException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
@evaisse
evaisse / debug.php
Last active December 30, 2015 12:29
<?php
/**
*
*/
function my_exception_handler($exception)
{
print '<pre>';
print $exception;
print '</pre>';
@evaisse
evaisse / auto-find-snippets.js
Created March 21, 2012 11:04
[KOMODO] Run snippets from keyword
/**
* Get and run a snippets from your toolbox.
*
* First snippet name is guess by word under your cursor or before your
* cursor if none selected. In our example : "fooBar"
* The script search a snippet named :
* 1. the word join with the language name (lowercase) -> "php_fooBar"
* 2. the snippet name with preceding joker (def "any_") -> "any_fooBar"
*
* the snippet is run if found, and nothing happen otherwise (except a nice
@evaisse
evaisse / backupThisFile.js
Created March 21, 2012 11:00
[KOMODO] backup this file
var filename = ko.views.manager.currentView.koDoc.baseName,
path = ko.views.manager.currentView.koDoc.displayPath;
/*
Set this to the path of your local directory where you want to backup your files
*/
var backupLocation = "/Users/evaisse/Library/Application Support/"
+ "KomodoEdit/autobackup";
<?php
/**
* get file mimetype
*
* Tries to get mime data of the file.
*
* @param str $filepath
* @return str mime-type of the given file, or false if nothing found
*/
@evaisse
evaisse / ErrorHandler.php
Created January 28, 2011 17:05
A hardened error handler for PHP script
<?php # -*- coding:utf-8 -*-
/**
* handle exceptions, errors ( convert them into ErrorException instances) ,
* even fatal errors too via shutdown registrered function.
* Provide a pretty smart debug pageon demand
*
* @example
@evaisse
evaisse / whatis.rb
Created December 3, 2010 16:46
A sample Grammar
Struct.Import
a(): 5,6,7
#
IF
a(): ENDDEF ()
/**
* get French date
*
* @example
* frenchDate(); // Lundi 13 Octobre
*
* @param date {Date} a date object, if none provided, now() is used
* @returns {String}
*/
<?php
$form = Form::create()->setMethod(Form::POST);
$form->addTextField('name', 'Name')->validRequired();
$form->addTextField('age', 'Age')->validNumeric();
$form->addSelectFIeld('rank','Rank :')->setOptions( 'User', 'Admin', 'Unknow' );
$form->addTextField('autre_fonction', 'Autre fonction:');
$form->addTextAreaField('adresse','Adresse:');
$form->addNumericField('code_postal','Code postal:')->setAttribute('size',5)->validSize(5);
$form->addTextField('tel_perso','Téléphone personnel:')->validPhoneNumber();