Skip to content

Instantly share code, notes, and snippets.

@aenigme
aenigme / .htaccess
Created September 9, 2014 01:06
Perishable Press 5G Blacklist
# 5G BLACKLIST/FIREWALL (2013)
# @ http://perishablepress.com/5g-blacklist-2013/
# 5G:[QUERY STRINGS]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} (\"|%22).*(<|>|%3) [NC,OR]
RewriteCond %{QUERY_STRING} (javascript:).*(\;) [NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3) [NC,OR]
RewriteCond %{QUERY_STRING} (\\|\.\./|`|=\'$|=%27$) [NC,OR]
@aenigme
aenigme / fullbackup.php
Created October 9, 2014 08:48
cPanel Backup Cronjob
Using the script* provided below you will be able to make automatic backup of your hosting account (domains and MySQL databases). This backup script includes SSL support. This is not necessary if you run the script on the server for which you are generating the backup; but the SSL support could be important if you are running the script somewhere else to connect to your cPanel hosting account.
<?php
// PHP script to allow periodic cPanel backups automatically, optionally to a remote FTP server.
// This script contains passwords. It is important to keep access to this file secure (we would ask you to place it in your home directory, not public_html)
// You need create 'backups' folder in your home directory ( or any other folder that you would like to store your backups in ).
@aenigme
aenigme / config.php
Created July 28, 2010 20:01
Kohana System Configuration Hook
<?php defined('SYSPATH') or die('No direct script access.');
class System_Config
{
// First host should be the production server.
public static $configs = array(
'example.com' => array(
'database.default.connection' => array(
'type' => 'mysql',
'user' => 'username',
@aenigme
aenigme / mysql-regex-match.sql
Created July 28, 2010 20:10
MySQL REGEX match comma-delimitted list
SELECT * FROM table
WHERE id REGEXP '(,|^){$this->list}(,|$)'
@aenigme
aenigme / .htaccess
Created August 6, 2010 16:02
Kohana htaccess file
RewriteEngine on
RewriteBase /
# Add www rule
# RewriteCond %{HTTP_HOST} ^example.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
# Remove www rule
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
@aenigme
aenigme / .htaccess
Created August 9, 2010 18:51
Perishable Press 4G Blacklist
### PERISHABLE PRESS 4G BLACKLIST ###
# ESSENTIALS
RewriteEngine on
ServerSignature Off
Options All -Indexes
Options +FollowSymLinks
# FILTER REQUEST METHODS
<IfModule mod_rewrite.c>
@aenigme
aenigme / vimeo_ipad.html
Created August 23, 2010 18:39
Embed Vimeo videos with support for iphone and ipad
<script type="text/javascript">
var agent=navigator.userAgent.toLowerCase();
var is_iphone = (agent.indexOf('iphone')!='-1');
var is_ipad = (agent.indexOf('ipad')!='-1');
if (is_iphone) {
document.write("<video src='http://www.vimeo.com/play_redirect?clip_id=00000000&quality=mobile' controls='controls' width='000' height='000'></video>");
}
else if (is_ipad) {
document.write("<video src='http://www.vimeo.com/play_redirect?clip_id=00000000' controls='controls' width='000' height='000'></video>");
}
@aenigme
aenigme / git_buttons.html
Created August 24, 2010 04:07
Inspired by the navigation menu on Git. Includes a base64 background image.
<style>
ul.tabs {
-moz-border-radius:5px 5px 5px 5px;
-webkit-border-radius:5px 5px 5px 5px;
border:1px solid #DDDDDD;
height:26px;
margin:10px 0 0;
padding:6px 10px;
position:relative;
background:url(data:image/gif;base64,R0lGODlhVwAmAMQAAOjo6Nzc3OTk5OXl5eLi4t/f3+np6ebm5uPj4+Dg4O3t7erq6ufn5+Hh4d7e3uvr6+zs7N3d3QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAABXACYAAAX/oCKOZGmeaKqubOu+cCyPUG3feK7vfO//wKBwSCwaj8jk7sFsOp/QqHRKrVqv2Kx2y+16v2DpYkwum8/otHrNbrvf8Lh8TjbY7/i8fs/v+/+AgYKDhIWGdwCJiouMjY6PkJGSk5AMlpeYmZqbnJ2en6ChoqOkpaaXB6mqq6ytrq+wsbKztLW2t7i5qgO8vb6/wMHCw8TFxsfIycrLzL0Cz9DR0tPU1dbX2NnWCNzd3t/g4eLj5OXm5+jp6uvs3QTv8PHy8/T19vf4+fr7/P3+//AaCBxIsKDBgwgTKlzIsKHDhxAjSpxIsaJFhAkyatzIsaPHjyBDihxJsqTJkyhTW2oswLKly5cwY8qcSbOmzZs4c+rcybOlg59AgwodSrSo0aNIkypdyrSp06dQo0qdWjSC1atYs2rdyrWr169gw4odS7as2bNo06rlGqCt27dw48qdS7eu3bt0QwAAOw==) repeat-x scroll 0 0 transparent;
@aenigme
aenigme / gradient.css
Created August 25, 2010 01:43
CSS3 Gradient Backgrounds
div.box {
-webkit-gradient(linear, left top, left bottom, from(red), to(white));
-moz-linear-gradient(red, white)
width: 480px;
height: 320px;
}
@aenigme
aenigme / MY_html.php
Created August 31, 2010 23:23
Extension for Kohana HTML helper
<?php defined('SYSPATH') or die('No direct script access.');
class html extends html_Core
{
/**
* Minify URI Builder
*
* @param string $href
* @param string $type
* @return string