Skip to content

Instantly share code, notes, and snippets.

View timothylhuillier's full-sized avatar

Tim_LHUILLIER timothylhuillier

View GitHub Profile
@timothylhuillier
timothylhuillier / gist:dd1f12f9a0afc2532f119c1e6aa50780
Created May 25, 2016 13:36 — forked from will83/gist:5920606
Fonction PHP permettant la conversion de Lambert93 à WGS84 (selon le fichier fourni par l'IGN).
<?php
function lambert93ToWgs84($x, $y){
$x = number_format($x, 10, '.', '');
$y = number_format($y, 10, '.', '');
$b6 = 6378137.0000;
$b7 = 298.257222101;
$b8 = 1/$b7;
$b9 = 2*$b8-$b8*$b8;
$b10 = sqrt($b9);
$b13 = 3.000000000;
ERROR Unhandled exception in HueFrontend (urn:uuid:dd0e9db2-53d7-4a49-80a8-e633dc44f796):
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pykka/actor.py", line 201, in _actor_loop
response = self._handle_receive(message)
File "/usr/local/lib/python2.7/site-packages/pykka/actor.py", line 295, in _handle_receive
return callee(*message['args'], **message['kwargs'])
TypeError: on_event() got an unexpected keyword argument ‘old_state’
@timothylhuillier
timothylhuillier / README.md
Created December 30, 2015 23:39
Secure Middleware for Laravel 5

I noticed that Laravel 5 doesn't have a secure (https) middleware since the removal of filters. So i have re-implemented it and shared the code in the hope that you find it useful.

Installation

  • Add Secure.php to your app\Http\Middleware directory.
  • Add the secure middleware to your route.

Notes

  • If you are using route annotations, don't forget to re-scan your routes using the php artisan route:scan command.
// PhantomJS Cheatsheet
$ brew update && brew install phantomjs // install PhantomJS with brew
phantom.exit();
var page = require('webpage').create();
page.open('http://example.com', function() {});
page.evaluate(function() { return document.title; });
// iMacro CheatSheet - Command Reference
// http://wiki.imacros.net/Command_Reference
// iMacros supports 3 types of variables:
// * The macro variables !VAR0 thru !VAR9. They can be used with the SET and ADD command inside a macro.
// * Built-in variables. They contain certain values set by iMacros.
// * User-defined variables. They are defined in-macro using the SET command.
#!/usr/bin/python
import time
import math
import mraa
# ============================================================================
# JGuyon driver MPR121 for LED
# ============================================================================
#auto wlan0
iface wlan0 inet dhcp
# For WPA
wpa-ssid SSID
wpa-psk PASSWORD
# For WEP
#wireless-essid Emutex
#wireless-mode Managed
#wireless-key s:password
@timothylhuillier
timothylhuillier / client.js
Last active August 29, 2015 14:21
Broadcast LMS
var dgram = require('dgram');
var socket = dgram.createSocket('udp4');
var message = new Buffer([0x65,
'I', 'P', 'A', 'D', 0x00,
'N','A', 'M', 'E', 0x00,
'J', 'S', 'O', 'N', 0x00,
'V', 'E', 'R', 'S', 0x00,
'U', 'U', 'I', 'D', 0x00,
'J', 'V', 'I', 'D', 0x1,0x2,0x3,0x4,0x5,0x6,0x7]);
#include <Akeru.h>
#include <LPD8806.h>
#include "SPI.h" // Comment out this line if using Trinket or Gemma
#include <SoftwareSerial.h>
/*
Double Analog input, Double analog output, serial output
Reads from two analog input pins, a T000020 Accelerometer Module connected
to I0 and I1, maps the result to a range from 0 to 255
and uses the result to set the pulsewidth modulation (PWM) on two T010111
@timothylhuillier
timothylhuillier / mapping_products.json
Created November 19, 2013 15:07
Mapping ES de PTF (searchly) pour le type "products"
curl -XPUT 'http://site:[email protected]/ptf/products/_mapping' -d
'{"products":{"properties":{"deleted_at":{"type":"date","format":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd"},"description":{"type":"string"},"location":{"type":"geo_point"},"photo":{"type":"string","index":"not_analyzed"},"price":{"type":"float"},"quantity":{"type":"string"},"shared_at":{"type":"date","format":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd"},"created_at":{"type":"date","format":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd"},"expiry_at":{"type":"date","format":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd"},"title":{"type":"string"},"user":{"properties":{"email":{"type":"string"},"id":{"type":"integer"},"name":{"type":"string"},"photo":{"type":"string","index":"not_analyzed"}}}}}}'