Skip to content

Instantly share code, notes, and snippets.

View FabienArcellier's full-sized avatar

Fabien Arcellier FabienArcellier

View GitHub Profile
@FabienArcellier
FabienArcellier / php.md
Last active December 19, 2015 03:39
List of PHP library
@FabienArcellier
FabienArcellier / Qt.md
Created June 30, 2013 18:08
Information about Qt
@FabienArcellier
FabienArcellier / haversine.sql
Last active December 20, 2015 20:58
Algorithm of Haversine to calculate distance between two gps coord for MySQL
DELIMITER //
CREATE FUNCTION `distance` (p1_latitude DOUBLE, p1_longitude DOUBLE, p2_latitude DOUBLE, p2_longitude DOUBLE) RETURNS DOUBLE
BEGIN
DECLARE deg2rad DOUBLE DEFAULT 0.0174; -- 3.14/180 or 2PI/360
DECLARE distance_latitude, distance_longitude, a DOUBLE;
SET distance_latitude = ( p2_latitude - p1_latitude ) * deg2rad;
SET distance_longitude = ( p2_longitude - p1_longitude ) * deg2rad;
SET a = sin( distance_latitude * .5 ) * sin( distance_latitude * .5 ) + cos( p1_latitude * deg2rad ) * cos( p2_latitude * deg2rad ) * sin( distance_longitude / 2 ) * sin( distance_longitude / 2 );
RETURN round( ( 2 * atan2( sqrt(a) , sqrt(1-a) ) ) * 6371000 , 3 ); -- 6371000 : curve rayon of earth ;
END
@FabienArcellier
FabienArcellier / HelloWorld.cs
Created December 8, 2013 19:52
Helloworld avec Intel Perceptual Computing SDK 2013. Cet exemple est compatible avec une simple webcam.
namespace HelloWorldSDK
{
using System;
using System.Drawing;
using System.Threading;
class Program
{
static void Main(string[] args)
{
@FabienArcellier
FabienArcellier / CaptureGestureIntelSDK.cs
Created December 15, 2013 21:56
Capture gesture with Intel Perceptual Computing SDK
namespace CaptureGestureIntelSDK
{
using System;
using System.Threading;
class Program
{
public static bool EndRequested = false;
static void Main(string[] args)
@FabienArcellier
FabienArcellier / program.cs
Created January 11, 2014 15:01
get the DotNetFramework path using ToolLocationHelper
using Microsoft.Build.Utilities;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DotNetPaths
{
// SymSpell: 1000x faster through Symmetric Delete spelling correction algorithm
//
// The Symmetric Delete spelling correction algorithm reduces the complexity of edit candidate generation and dictionary lookup
// for a given Damerau-Levenshtein distance. It is three orders of magnitude faster and language independent.
// Opposite to other algorithms only deletes are required, no transposes + replaces + inserts.
// Transposes + replaces + inserts of the input term are transformed into deletes of the dictionary term.
// Replaces and inserts are expensive and language dependent: e.g. Chinese has 70,000 Unicode Han characters!
//
// Copyright (C) 2012 Wolf Garbe, FAROO Limited
// Version: 1.6
@FabienArcellier
FabienArcellier / BotObject.cs
Created January 14, 2014 12:49
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/
Class Element : BotObject
{
Behavior={":black", ":next_click_white"}
}
class BlackBehavior
{
Trigger = {":click"},
Reaction( (o) => {
System.WriteLine("Noir")
#!/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
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