Skip to content

Instantly share code, notes, and snippets.

View FabienArcellier's full-sized avatar

Fabien Arcellier FabienArcellier

View GitHub Profile
@FabienArcellier
FabienArcellier / BitmapInfo.cs
Created November 28, 2012 23:05
Class in C# to extract pixel map from a specific channel
using System.Drawing;
namespace PictureHistogram
{
/// <summary>
/// Class that expose method to get pixel map from a specific channel
/// </summary>
class BitmapInfo
{
private Bitmap m_bitmap;
@FabienArcellier
FabienArcellier / .htaccess
Created December 2, 2012 18:18
Disable indexaction or block access to a directory in htaccess file
# disable directory browsing
Options All -Indexes
# Deny access to this directory for anybody
Order allow,deny
Deny from all
@FabienArcellier
FabienArcellier / install_composer.sh
Created December 9, 2012 15:11
Install composer on linux machine
sudo curl -s https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin/
@FabienArcellier
FabienArcellier / index.php
Created December 9, 2012 15:51
Autoload namespace manually from silex
<?php
$loader = require_once __DIR__.'/vendor/autoload.php';
$loader -> add('Application', __DIR__); // PSR-0 autoloading, the directory '__DIR__/Application' must exists
$app = new Silex\Application();
$app->run();
?>
@FabienArcellier
FabienArcellier / disable_unc_check.reg
Created December 11, 2012 15:41
Disable Unc Check in register database
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"DisableUNCCheck"=dword:00000001
@FabienArcellier
FabienArcellier / famille.prolog
Created December 14, 2012 14:26
Family Link
/* Programme sur les liens familiaux */
pere(paul, jean).
pere(paul, frederic).
pere(emilie, marie).
pere(jean, andre).
pere(jean, cathy).
pere(jean, francis).
pere(frederic, marc).
pere(frederic, lisa).
@FabienArcellier
FabienArcellier / menu.prolog
Created December 14, 2012 15:39
Create menu with price and calories associate with it
entree(salade, 5, 400).
entree(taboulee, 3, 300).
plat(andouillette, 8, 500).
plat(steak, 10, 900).
fromage(bri, 3, 150).
fromage(camembert, 4, 300).
dessert(tarte, 5, 320).
% list_contains(5, [1,2]) % Renvoie false
% list_contains(5, [1,5]) % Renvoie true
list_contains(X, [X|_]).
list_contains(X, [_|R]):- list_contains(X, R).
@FabienArcellier
FabienArcellier / factorielle.prolog
Created December 20, 2012 15:09
Calculate a factoriel using prolog
fact(0,1).
fact(1,1).
fact(X, Result):- X > 1, X1 is X-1, fact(X1, Result1), Result is Result1 * X.
@FabienArcellier
FabienArcellier / fibonacci.prolog
Created December 20, 2012 15:10
Calculate fibonacci suite
fibo(1, Result):- Result is 1.
fibo(2, Result):- Result is 1.
fibo(X, Result):- X > 2, X1 is X - 1, X2 is X - 2, fibo(X1, ResultN1), fibo(X2, ResultN2), Result is ResultN1 + ResultN2.