1 month ago
function walkDom($node, $level = 0) {
$indent = '';
for ($i = 0; $i < $level; $i++)
$indent .= ' '; //prettifying the output
if (true /*$node->nodeType == XML_TEXT_NODE*/) {
echo $indent.
'<b>'.
$node->
nodeName.
'</b> - |'.
$node->
nodeValue.
'|';
if ( $node->nodeType == XML_ELEMENT_NODE ) {
$attributes = $node->attributes; // get all the attributes(eg: id, class)
foreach($attributes as $attribute) {
echo ', '.
$attribute->
name.
'='.
$attribute->
value;
}
}
}
$cNodes = $node->childNodes;
if (count($cNodes) >
0) {
$level++ ; // go one level deeper
foreach($cNodes as $cNode)
walkDom($cNode, $level);
$level = $level - 1;
}
}
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2092"></script>
2 months ago
Create a specific user for backups purpose with read-only permissions
GRANT SHOW DATABASES, SELECT, LOCK TABLES, RELOAD ON *.* to backup@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2082"></script>
4 months ago
Il faut avoir un backup de base tel qu'il y ait un dossier par base de donnée, un fichier SQL compressé par table. "-P 4" désigne le nombre de core.
find -print0 | xargs -0 -n 1 -P 4 -I {} sh -c "zcat '{}' | mysql mydatabase"
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2071"></script>
5 months ago
svn switch --relocate svn://svnserver1 svn://svnserver2
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2062"></script>
5 months ago
# htpasswd file is relative to nginx conf
location / {
auth_basic "Restricted";
auth_basic_user_file conf/htpasswd;
}
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2061"></script>
5 months ago
Scripted install of MySQL
echo mysql-server mysql-server/root_password select PASSWORD | debconf-set-selections
echo mysql-server mysql-server/root_password_again select PASSWORD | debconf-set-selections
aptitude -y install mysql-server libmysqlclient15-dev
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2060"></script>
5 months ago
shell,fuser,process,resource,bash,file
fuser -v /var/cache/debconf/config.dat
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2059"></script>
7 months ago
Prevents jobs to collide if they take longer to run than the frequency itself
$fp =
fopen('/tmp/lock.txt',
'r+');
if(!
flock($fp, LOCK_EX | LOCK_NB
)) {
echo 'Unable to obtain lock';
}
/* ... */
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2040"></script>
7 months ago
it's also possibl with a .htaccess file and "deny from all " in that file
if (isset($_SERVER['REMOTE_ADDR'])) die('Permission denied.');
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2039"></script>
7 months ago
#someElement {
background: red; /* modern browsers */
*background: green; /* IE 7 and below */
_background: yellow; /* IE6 exclusively */
}
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2037"></script>