This file contains hidden or 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 | |
// This test script is designed to be run from the command line. | |
// It measures the subject string length that results in a | |
// PREG_RECURSION_LIMIT_ERROR error in the preg_match() function. | |
echo("Entering TEST.PHP...\n"); | |
// Set and display pcre.recursion_limit. (set to stacksize / 500). | |
// Under Win32 httpd.exe has a stack = 256KB and 8MB for php.exe. | |
//ini_set("pcre.recursion_limit", "524"); // Stacksize = 256KB. |
This file contains hidden or 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 | |
// SEEMORE: http://stackoverflow.com/questions/7620910/regexp-in-preg-match-function-returning-browser-error | |
var_dump( | |
preg_match('/\\G"((?:[^"\\\\\\r\\n]|\\\\.|\\\\\\r\\n|\\\\[\\n\\r\\f])*)"|\'((?:[^\'\\\\\\r\\n]|\\\\.|\\\\\\r\\n|\\\\[\\n\\r\\f])*)\'/','.foo { | |
bar: \'/00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\'; | |
}', $match, 0, 12) | |
); | |
var_dump($match); |
This file contains hidden or 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
.make-columns(@name; @columns; @gutter-width: @grid-gutter-width) { | |
@class-lg: ~".col-lg-@{name}"; | |
> @{class-lg} { | |
.make-lg-column((@grid-columns / @columns); @gutter-width); | |
} | |
@class-md: ~".col-md-@{name}"; | |
> @{class-md} { | |
.make-md-column((@grid-columns / @columns); @gutter-width); | |
} | |
@class-sm: ~".col-sm-@{name}"; |
This file contains hidden or 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
// Extra framework grid generation | |
// | |
// Based on bootstrap/grid-framework.less | |
.x-make-grid-columns(@columns: @grid-columns, @gutter-width: @grid-gutter-width, @prefix: ".col") { | |
// Common styles for all sizes of grid columns, widths 1-12 | |
.x-col(@index) { // initial | |
@item: ~"@{prefix}-xs-@{index}-of-@{columns}, @{prefix}-sm-@{index}-of-@{columns}, @{prefix}-md-@{index}-of-@{columns}, @{prefix}-lg-@{index}-of-@{columns}"; | |
.x-col((@index + 1), @item); | |
} |
This file contains hidden or 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
<script> | |
{% textstrip %} | |
var _gaq = window._gaq || []; | |
var trackError = function(msg, url, line, column, error, action) { | |
if (!(error !== undefined && error.stack)) { | |
error = function() { try { throw Error(msg) } catch(e) { return e; } }(); | |
} | |
var report = (error !== undefined && error.stack ? String(error.stack).replace(/\n\s*/g, ' --> ') + ' message:' + msg : msg) + ' at ' + url + ':' + line + ':' + column + ' date:' + Date(); | |
_gaq.push(['_trackEvent', action, report, '#{{ request.user.id|default:"0" }} ip:{{ request.META.REMOTE_ADDR|escapejs }} ua:' + window.navigator.userAgent + ' error:' + report, 0, true]); | |
if (typeof(console) != 'undefined') { |
This file contains hidden or 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
#!/bin/sh | |
set -x | |
for i in `mysql --batch --execute 'SELECT CONCAT("\`", REPLACE(table_schema, "\`", "\`\`"), "\`.\`", REPLACE(table_name, "\`", "\`\`"), "\`") as \`mysql.db\` FROM information_schema.tables where ENGINE="MyISAM" and table_schema!="information_schema"'`; do mysql --execute "OPTIMIZE NO_WRITE_TO_BINLOG table $i;"; done | |
for i in `mysql --batch --execute 'SELECT CONCAT("\`", REPLACE(table_schema, "\`", "\`\`"), "\`.\`", REPLACE(table_name, "\`", "\`\`"), "\`") as \`mysql.db\` FROM information_schema.tables where ENGINE="InnoDB" and table_schema!="information_schema"'`; do mysql --execute "ALTER TABLE $i ENGINE=InnoDB; ANALYZE NO_WRITE_TO_BINLOG TABLE $i;"; done | |
mysql --execute 'PURGE BINARY LOGS BEFORE NOW();' | |
mysql --execute 'FLUSH TABLES;' |
This file contains hidden or 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
du -s *|sort -nr|cut -f 2-|while read a;do du -hs $a;done |
This file contains hidden or 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
for X in *.jpg; do convert "$X" -resize "1920x1200>" -strip -quality 86 "$X"; done |
This file contains hidden or 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
<?xml version="1.0"?> | |
<!-- A sample XML transformation style sheet for displaying the Subversion | |
directory listing that is generated by mod_dav_svn when the "SVNIndexXSLT" | |
directive is used. --> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:output method="html" omit-xml-declaration="yes" | |
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" | |
doctype-system="http://www.w3.org/TR/html4/loose.dtd" /> |
This file contains hidden or 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
#!/usr/bin/env bash | |
cd /var/backups/root | |
# backup root folders | |
tar -cvzf root.$(date +%F).tgz /bin/ /boot/ /etc/ /home/ /lib/ /lib64/ /opt/ /root/ /sbin/ /usr/ | |
# remove older backups | |
find /var/backups/root -type f -name '*.tgz' -mtime +30 -delete |