( | 9 |
---|---|
) | 0 |
--- | --- |
/ | ! |
--- | --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
*** | |
Modified generic daemon class | |
*** | |
Author: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ | |
www.boxedice.com | |
License: http://creativecommons.org/licenses/by-sa/3.0/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source : http://stackoverflow.com/questions/3311903/remove-duplicate-rows-in-mysql | |
ALTER IGNORE TABLE my_table_name ADD UNIQUE INDEX my_index_name (my_column_1, my_column_2, my_column_3, ... ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP FUNCTION IF EXISTS BIG_SEC_TO_TIME; | |
DELIMITER $$ | |
CREATE FUNCTION BIG_SEC_TO_TIME(SECS BIGINT) | |
RETURNS TEXT | |
READS SQL DATA | |
DETERMINISTIC | |
BEGIN | |
DECLARE HEURES TEXT; | |
DECLARE MINUTES CHAR(5); | |
DECLARE SECONDES CHAR(5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Convert duration in second to duration in ISO8601 | |
* http://www.w3schools.com/Schema/schema_dtypes_date.asp#Duration Data Type | |
* http://en.wikipedia.org/wiki/ISO_8601#Durations | |
* | |
* @param integer $duration in second seconde | |
* @return string duration in ISO8601 | |
* | |
* >= PHP 5.3 : use DateInterval <http://www.php.net/manual/en/dateinterval.construct.php> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Return the value of an attribute in HTML tag | |
*/ | |
function getAttribute($attrib, $tag) | |
{ | |
$re = '/' . preg_quote($attrib) . '=([\'"])?((?(1).+?|[^\s>]+))(?(1)\1)/is'; | |
if (preg_match($re, $tag, $match)) | |
return urldecode($match[2]); | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _in = 'erwan123'; | |
var _out = []; | |
var map = ['0 ','1','2abc','3def','4ghi','5jkl','6mno','7pqrs','8tuv','9wxyz']; | |
for(var i = 0; i < _in.length; i++) | |
{ | |
for (var j = 0; j < map.length; j++) | |
{ | |
if (map[j] && map[j].indexOf(_in[i]) > -1) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
def random_lolcat | |
open("http://icanhascheezburger.com/?random").read.match(/"http:\/\/icanhascheezburger\.files\.wordpress\.com\/[^"]+/)[0][1..-1] | |
end |