Skip to content

Instantly share code, notes, and snippets.

View kane-thornwyrd's full-sized avatar
🏠
Working from home

Jean-cédric T. kane-thornwyrd

🏠
Working from home
  • France
  • 07:16 (UTC +02:00)
View GitHub Profile
@kane-thornwyrd
kane-thornwyrd / gist:2941189
Created June 16, 2012 12:15
Executer une commande système et avoir les retours
<?php
$output = array();
$returned_code = 0;
exec('echo 0 > /dev/ttyAM0; cat /dev/ttyAM0', $output, $returned_code);
print_r($output);
echo 'Avec un code de retour: ' . $returned_code;
@kane-thornwyrd
kane-thornwyrd / gist:2954840
Created June 19, 2012 15:35
Basic com between Resperry Pie and Arduino in PHP
<?php
//(c) Lucas Lombard
$error = "No Sockets";
$list = shell_exec("screen -ls");
if (strpos($list, $error) !== FALSE) {
exec('screen -dmS arduino /dev/ttyAMA0 115200');
sleep(1);
exec('screen -p 0 -S arduino -X eval \'stuff \"2\"\'');
header('Location: '.$_SERVER['PHP_SELF']);
}
@kane-thornwyrd
kane-thornwyrd / c.js
Created July 1, 2012 13:54
Demo for Angelspit
var
cx = (c = document.getElementById('c')).getContext('2d'),
size=800,
ra=Math.random,
cE=Math.ceil,
w = window,
d=document,
UC=function(c){return String.fromCharCode(parseInt(c,16))}
u = 1,
f=255,
@kane-thornwyrd
kane-thornwyrd / views-admin.css
Created October 17, 2012 12:25
Necessary CSS patch for Views 3.x
div.views-display-column>div.views-ui-display-tab-bucket{
position: relative;
}
@kane-thornwyrd
kane-thornwyrd / gist:3912469
Created October 18, 2012 15:12
How to Inserting a photo into a vCard 2.1
<?php
/*
Public Domain
Original by Twen from #Drupalfr on IRC Freenode.
*/
/* Inserting a photo into a vCard 2.1 */
@kane-thornwyrd
kane-thornwyrd / kGUI.lua
Created February 9, 2013 23:39
- kGUI : a Graphical User Interface Library for ComputerCraft - oop : an Object Oriented Programming Library for lua with code borrowed from the official Wiki and tuned for my needs.
if not oop then os.loadAPI('oop') end
if not term then os.loadAPI('term') end
if not colors and term.isColour()
then os.loadAPI('colors')
else colors = {
white = 1,
orange = 2,
magenta = 4,
lightBlue = 8,
yellow = 16,
@kane-thornwyrd
kane-thornwyrd / gist:4977964
Created February 18, 2013 14:53
Juste un prototype de procédure de travail collaboratif pour Drupal…

Procédure de travail collaboratif

Pré-requis

  • Une machine avec un système d'exploitation, GNU/Linux ou Unix-like (BSD, Mac Os X) conseillés
  • Apache
  • PHP >5.3
  • BDD : MySQL ou MariaDB de préférence. SQLite reste néanmoins possible.
  • Git
  • Git Flow : Instructions d'installation
  • Installer drush via Pear, de préférence, Instructions d'installation
@kane-thornwyrd
kane-thornwyrd / parazitic.php
Created February 18, 2013 14:55
Un vieux truc pour poster automatiquement l'éphéméride sur un status.net like
<?php
/******************************************************\
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@kane-thornwyrd
kane-thornwyrd / server.coffee
Last active December 16, 2015 17:39
Quick and simple Node.js Server writen in Coffeescript
http = require 'http'
path = require 'path'
fs = require 'fs'
port = 80
sysout = console.log
CONTENT_TYPES =
html : 'text/html'
js : 'application/javascript'
@kane-thornwyrd
kane-thornwyrd / .sublime-keymap
Created May 3, 2013 15:36
Increase usefulness of ctrl+r in ST2-3
{
"keys" : ["super+r"],
"command" : "show_overlay",
"args" : {
"overlay" : "goto",
"text" : "@function "
}
}