les commandes/codes pratiques que j'oublie...

current date in oracle ⇒ sysdate sysdate-1 … are ok

mysql, copy a table, for a fast backup

CREATE TABLE student2 SELECT * FROM student

grep -lir “some text” *

find . -name *.extension -exec ls {} \;

#list debian pkg, perfect for my openmoko
grep -e Package: -e Description /var/lib/dpkg/available | vi -

function getIpAddress() {
return (empty($_SERVER['HTTP_CLIENT_IP'])?(empty($_SERVER['HTTP_X_FORWARDED_FOR'])?
$_SERVER['REMOTE_ADDR']:$_SERVER['HTTP_X_FORWARDED_FOR']):$_SERVER['HTTP_CLIENT_IP']);
}
function is_valid_email_address($email){
	$qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';
	$dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';
	$atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'.
		'\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+';
	$quoted_pair = '\\x5c[\\x00-\\x7f]';
	$domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d";
	$quoted_string = "\\x22($qtext|$quoted_pair)*\\x22";
	$domain_ref = $atom;
	$sub_domain = "($domain_ref|$domain_literal)";
	$word = "($atom|$quoted_string)";
	$domain = "$sub_domain(\\x2e$sub_domain)*";
	$local_part = "$word(\\x2e$word)*";
	$addr_spec = "$local_part\\x40$domain";
 
	return preg_match("!^$addr_spec$!", $email) ? 1 : 0;
}

from www.iamcal.com

unixtime to local/GMT


20100730 17:45:12 local
20100730 15:45:12 GMT

& for Brussels
sunrise => 06:06:40
sunset => 21:31:30
transit => 13:49:05
civil_twilight_begin => 05:26:45
civil_twilight_end => 22:11:25
nautical_twilight_begin => 04:33:12
nautical_twilight_end => 23:04:58
astronomical_twilight_begin => 03:19:35
astronomical_twilight_end => 00:18:35

diff between two dates


19700101 01:00:00 <-----> 20100730 17:45:12
1280504712 seconds
14821 days
40 years & 221 days

code/unix.txt · Last modified: 2009/10/22 15:55 by aurelien
Creative Commons License Driven by DokuWiki Recent changes RSS feed