Skip to content

Instantly share code, notes, and snippets.

View clone1018's full-sized avatar

Luke Strickland clone1018

View GitHub Profile
# Why rewrite URLs? Read this: http://en.wikipedia.org/wiki/Rewrite_engine
# Apache (.htaccess or httpd.conf)
# Make sure AllowOverride is on for the directory, or put the rewrite rules in httpd.conf
# http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
# Nginx (nginx.conf)
### BEGIN INIT INFO
# Provides: quasselcore
# Required-Start: $network $local_fs
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: distributed IRC client using a central core component
# Description: This is the core component of Quassel. A modern,
@clone1018
clone1018 / gist:1099699
Created July 22, 2011 15:42
Oper Plugin
<?php
/**
* OperHelper
*
* A simple plugin to help opers with their tedious tasks.
*
* @author clone1018
* @copyright Copyright (c) 2008 - 2011, Axxim
* @link http://axxim.net/
<?php
/**
* OperHelper
*
* A simple plugin to help opers with their tedious tasks.
*
* @author clone1018
* @copyright Copyright (c) 2008 - 2011, Axxim
* @link http://axxim.net/
.bf <prog> -- executes brainfuck program <prog>
.calc <term> -- returns Google Calculator result
.chnick <nick> - Change the nick!
.choose <choice1>, <choice2>, ... <choicen> -- makes a decision
.deadfly <adf.ly url> -- scrapes link shortened by adf.ly
.define/.dictionary <word> -- fetches definition of <word>
.down <url> -- checks to see if the site is down
.8ball <question> - ask the 8ball a question
.e/.etymology <word> -- Retrieves the etymology of chosen word
.expand <shorturl> -- expand link shortened url
@clone1018
clone1018 / mcping.php
Created October 30, 2011 16:39
Minecraft Ping
<?php
function ping($host, $port=25565, $timeout=30) {
$handle = fsockopen($host, $port, $errno, $errstr, $timeout);
try {
fwrite($handle, "\xFE");
$d = fread($handle, 256);
if ($d[0] != "\xFF") return false;
$d = substr($d, 3);
$d = mb_convert_encoding($d, 'auto', 'UCS-2');
$d = explode("\xA7", $d);
<?php
class ftp{
public $conn;
public function __construct($url){
$this->conn = ftp_connect($url);
}
public function __call($func,$a){
<?php
function humanReadableOctets($octets) {
$units = array('B', 'kB', 'MB', 'GB', 'TB');
for ($i = 0, $size =$octets; $size>1024; $size=$size/1024)
$i++;
return number_format($size, 2) . ' ' . $units[min($i, count($units) -1 )];
}
import re
class linkextractor:
def __init__(self,htmlPage):
self.htmlcode = htmlPage
def getLinks(self):
linksList = re.findall('<a href=(.*?)>.*?</a>',self.htmlcode)
links = []
for link in linksList:
if link.startswith('"'): link=link[1:] # Remove quotes
<?php
// Welcome to Ignite
// Ignite is a new way to share, run and save code.
//
// You can get started by simply writing code, or pasting your
// existing code here. After that you can hit Play or Save.
// Playing code automatically compiles and saves it.
//
// If you find any problems feel free to join us on irc at
// irc.esper.net #axxim or email me at [email protected]