Instantly share code, notes, and snippets.

View ajax-cache-include.js
/**
* Cache AJAX-included scripts.
*/
$.cachedScript = function (url, options) {
options = $.extend(
options || {}, {
dataType: "script",
cache: true,
url: url
}
View fastestRandomSelect.sql
# Ejemplo 1
SELECT * FROM post AS r1 JOIN (SELECT (RAND() * (SELECT MAX(postid) FROM post)) AS postid) AS r2 WHERE r1.postid >= r2.postid ORDER BY r1.postid ASC LIMIT 10
# Ejemplo 2
SELECT * FROM (SELECT * FROM `comprobantes` WHERE `ind-estado` = 'procesando' OR (`ind-estado` = 'rechazado' AND `respuesta-xml` IS NULL)) AS r1 JOIN (SELECT (RAND() * (SELECT MAX(id) FROM comprobantes)) AS id) AS r2 WHERE r1.id >= r2.id ORDER BY r1.id ASC LIMIT 100
View checknstart_service_if_down.sh
#!/bin/bash
echo '[Start service if it is down]'
echo
# ZARZA | A HEAD OF OUR TIME
# https://zarza.com
service=nginx
if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is up!"
View create_emails_from_txt.sh
#!/bin/bash
echo '[Create multiple email addresses in Plesk from a text file easily]'
echo
# ZARZA | A HEAD OF OUR TIME
# https://zarza.com
FILE='mails.txt'
if [ -f $FILE ]; then
while read p; do
View gist:75b907583ecef3c46531
#Try 'REPAIR TABLE postparsed;' first.
DROP TABLE `postparsed`;
CREATE TABLE IF NOT EXISTS `postparsed` (
`Postid` int (10) unsigned NOT NULL default '0',
`Dateline` int (10) unsigned NOT NULL default '0',
`Styleid` smallint (5) unsigned NOT NULL default '0',
`Languageid` smallint (5) unsigned NOT NULL default '0',
`Hasimages` smallint (6) NOT NULL default '0',
`Pagetext_html` medium text,