Skip to content

Instantly share code, notes, and snippets.

View apeyroux's full-sized avatar

Aλexandre Peyroux apeyroux

View GitHub Profile
@apeyroux
apeyroux / rio2ter.scala
Created August 1, 2013 22:19
Pseudo code scala pour update code rio/dialog dans TerNG
object rio2ter extends App {
var lResultMySQL = List("PA0001", "PA0002", "PA0003", "PA0004", "PA005")
var lTypeZone = List("zsp", "csp", "ddsp")
var wsRio = new scala.util.Random;
def mysql2lcodedialog(typeZone:String) = {
def query(typeZone:String) = "SELECT idRio from ".concat(typeZone)
println("Faire la requette : " + query(typeZone) + " puis en retourner la liste de code dialog.")
lResultMySQL.foreach(r => r.concat(typeZone))
@apeyroux
apeyroux / anlog.hs
Created September 5, 2013 09:34
Haskell Apache Log Analyse
import Text.ParserCombinators.Parsec
import Control.Applicative
import System.Environment
import Data.Function
import Data.List
data LogLine = LogLine {
getIP :: String
, getIdent :: String
, getUser :: String
@apeyroux
apeyroux / gist:8117832
Last active January 1, 2016 08:19
Force the solicitation of tiles on #OSM cache server
import HSlippyMap
main = do
mapM (\(x,y) -> mapM (\y'-> print $ "http://openstreetmap.asi.mi/" ++ show z ++ "/" ++ show x ++ "/" ++ show y' ++ ".png") y) [(x,\
[(minimum [tymin, tymax])..(maximum [tymin,tymax])]) | x <- [(minimum [txmin, txmax])..(maximum [txmin, txmax])]]
where
min = tileFromLatLong 49.13 3.05 8
max = tileFromLatLong 48.57 1.66 8
txmin = tx min
txmax = tx max
@apeyroux
apeyroux / titiles
Last active January 1, 2016 10:29
Test perf cache #OSM
{--
Bessans :
min = tileFromLatLong 45.32 6.98 19
max = tileFromLatLong 45.31 7.01 19
--}
import HSlippyMap
import Network.Curl
lbbox = [[(49.13, 3.05),(48.57,1.66)]]
@apeyroux
apeyroux / touch tile
Created January 3, 2014 20:06
Test TileMill server with ile de france bbox. time ./hsl | xargs wget -nv -O NULL --output-file tilemill.log
#!/usr/local/bin/runhaskell
import HSlippyMap
listLevel mi ma z =
mapM_ (\(x,y) -> mapM (\y'->
print $ "http://127.0.0.1:20008/tile/openstreetmap-carto/" ++ show z ++ "/" ++ show x ++ "/" ++ show y' ++ ".png") y)
[(x,[(minimum [tymin, tymax])..(maximum [tymin,tymax])]) | x <- [(minimum [txmin, txmax])..(maximum [txmin, txmax])]]
where
min = tileFromLatLong (fst mi) (snd mi) z
import Network.Curl
import System.IO
import Data.List
main = do
h <- openBinaryFile "lrues.txt" ReadMode
c <- hGetContents h
mapM (\x -> do
resp <- (curlGetResponse_ ("http://10.192.45.36/JDONREFv3JSON/Normalise?application=2&services=1&operation=1&donnees=&donnees=appartement%200%20entr%C3%A9e%20B&donnees=&donnees=24-26%20ter%20rue%20d" ++ x) [] :: IO CurlResponse)
r <- (respGetInfo resp TotalTime)
@apeyroux
apeyroux / Scrabble
Created February 9, 2014 22:41
Test d'une calculette scrabble en une ligne
(mapM (\l -> putStr ("Point for " ++ show l ++ " ? : ") >> getLine >>= (\p -> return (read p::Int))) "mot") >>= return . foldr (+) 0 >>= (\x->do r<-(putStr "Bonus coef ? : " >> getLine >>= (\b -> return (read b::Int))); print $ r*x)
-- | URL Doc : http://hackage.haskell.org/package/url-2.1.3/docs/Network-URL.html
module Page where
import Network.URL
import Network.Curl
import Text.XML.HXT.Core
import Text.HandsomeSoup
data Page = Page {
title :: String,
@apeyroux
apeyroux / gist:1e5772468cd0b34d3715
Created May 27, 2014 12:31
socket.io and celery
// Server
var http = require('http');
var fs = require('fs');
var redis = require('redis').createClient(6379, "10.73.0.1");
// Chargement du fichier index.html affiché au client
var server = http.createServer(function(req, res) {
fs.readFile('./index.html', 'utf-8', function(error, content) {
res.writeHead(200, {"Content-Type": "text/html"});
@apeyroux
apeyroux / gist:4eeb24c49d57b308a800
Created July 29, 2014 16:36
Exemple auth online.net with golang
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"