Skip to content

Instantly share code, notes, and snippets.

View FabienArcellier's full-sized avatar

Fabien Arcellier FabienArcellier

View GitHub Profile
@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")
// 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 / 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
{
@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 / 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 / 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 / Qt.md
Created June 30, 2013 18:08
Information about Qt
@FabienArcellier
FabienArcellier / php.md
Last active December 19, 2015 03:39
List of PHP library
var MyCollection = Backbone.Collection.extend({
//custom methods
fetch: function(options) {
//do specific pre-processing
//Call Backbone's fetch
return Backbone.Collection.prototype.fetch.call(this, options);
@FabienArcellier
FabienArcellier / svn2git.bash
Last active December 15, 2015 15:49
This bash snippet is a script to migrate svn repository with a structure (trunk, branches and tags) to a new git repository. It take care of doing authors matching and remove the adress of old svn
#!/bin/bash
# This snippet suppose the file authors_list exists
# take a look at http://www.yterium.net/Migrer-un-projet-SVN-vers-GIT
if [[ "$1" == "" && "$2" == "" ]] ; then
echo "$1"
echo "$2"
echo "Arguments are invalid"
exit
fi