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
<pre> | |
<?php | |
require_once('config.php'); | |
$sql = 'SELECT time/(15*60), COUNT(DISTINCT userid) FROM mdl_log | |
GROUP BY time/(15*60)'; | |
print_r(recordset_to_array(get_recordset_sql($sql))); | |
?> | |
</pre> |
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
RewriteCond %{SERVER_PORT} 80 | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
php_value session.cookie_secure 1 | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteCond %{HTTPS}s ^on(s)| | |
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
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
function valid_email_address($mail) { | |
return (bool)filter_var($mail,FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>"/^[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/"))); | |
} |
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
mysql databasename -u [root] -p[password] -e 'show tables like "wp_153_%"' | grep -v Tables_in | |
| xargs mysqldump [databasename] -u [root] -p[password] > [target_file] |
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
#sidebar { | |
min-height: 580px; | |
height: auto !important; | |
height: 580px; | |
} |
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 | |
require_once('config.php'); | |
require_once('lib/datalib.php'); | |
require_once('version.php'); | |
$moodle_release = substr($release,0,3); | |
if ($moodle_release == "1.9") { | |
$version = get_field('config', 'value', 'name', 'version'); | |
} |
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 | |
// Register our shutdown function so that no other shutdown functions run before this one. | |
// This shutdown function calls exit(), immediately short-circuiting any other shutdown functions, | |
// such as those registered by the devel.module for statistics. | |
register_shutdown_function('status_shutdown'); | |
function status_shutdown() { | |
exit(); | |
} | |
// Drupal bootstrap. |
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
# A naive dns server with a Redis backend | |
# Set keys in Redis you want to be authoritative for (set google.com. 127.0.0.1) | |
# Tip: Use Redis's ttl functions to have temporary names | |
# Currently only does A records, feel free to fix that | |
# | |
# Licensed under the PSF License | |
# Thanks to: http://code.activestate.com/recipes/491264-mini-fake-dns-server/ | |
# Author: @Kaerast <alice@kaerast.info> | |
import socket |
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
# Needs extending to show correct image, but this is a minimally working setup | |
define command{ | |
command_name alert-service-by-ducksboard | |
command_line curl -u $USER1$:ignored -d '{"value": {"title": "$NOTIFICATIONTYPE$", "image":"https://app.ducksboard.com/static/img/timeline/created.png", "content": "Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$"}}' https://push.ducksboard.com/values/$USER2$/ | |
} | |
define command{ | |
command_name alert-host-by-ducksboard | |
command_line curl -u $USER1$:ignored -d '{"value": {"title": "$NOTIFICATIONTYPE$", "image":"https://app.ducksboard.com/static/img/timeline/created.png", "content": "Alert: $HOSTALIAS$ is $HOSTSTATE$"}}' https://push.ducksboard.com/values/$USER2$/ |
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
openssl genrsa -des3 -out server.key -passout pass:riakssl 1024 | |
openssl req -new -key server.key -out server.csr -passin pass:riakssl \ | |
-subj /DC=US/DC=Massachussets/DC=Cambridge/O=Basho/OU=Engineering/CN=Riak | |
openssl rsa -in server.key -out key.pem -passin pass:riakssl | |
openssl x509 -req -days 365 -in server.csr -signkey server.key -out cert.pem -passin pass:riakssl | |
rm server.key server.csr |