Skip to content

Instantly share code, notes, and snippets.

View xeoncross's full-sized avatar

David Pennington xeoncross

View GitHub Profile
<?php
if(isset($_GET['success'])){
echo 'done';
exit;
}
$policy = base64_encode(str_replace(array("\r","\n"),"",'{ "expiration": "2023-01-01T12:00:00.000Z", "conditions": [
{"acl": "public-read" },
{"bucket": "MYBUCKET" },
<?php
/**
* A class wrapper for PECL Libevent [http://www.php.net/manual/en/book.libevent.php]
* @author Paul Thrasher [http://paulthrasher.com/] 1/17/11
**/
/**
* // an example func that just exits
* function handler_func($fd, $events, $arg){ $arg[1]->loopexit(); };
@xeoncross
xeoncross / http.php
Created April 21, 2014 17:21 — forked from volca/http.php
<?php
function http_get($host) {
// create event base
$base_fd = event_base_new();
// create a new event
$event_fd = event_new();
// resource to be monitored
@xeoncross
xeoncross / MyNodeVisitor.php
Last active August 29, 2015 14:00
Wordpress parser to make a lightweight wordpress using the PHP-Parser by nikic
<?php
// https://github.com/nikic/PHP-Parser/blob/master/lib/PhpParser/NodeVisitor.php
use PhpParser\Node;
use PhpParser\Node\Stmt;
class MyNodeVisitor extends PHPParser_NodeVisitorAbstract {
public $internal = array();
public $replacements = array();
<?php
require_once('attachment.class.php');
/**
* Fast Mime Mail parser Class using PHP's MailParse Extension
* @author gabe@fijiwebdesign.com
* @url http://www.fijiwebdesign.com/
* @license http://creativecommons.org/licenses/by-sa/3.0/us/
* @version $Id$
@xeoncross
xeoncross / composer.json
Created May 2, 2014 18:03
How to normalize a web URL (also removes the schema)
{
"require": {
"glenscott/url-normalizer" : "dev-master"
}
}
#!/usr/bin/env php
<?php
$socket = stream_socket_server("tcp://127.0.0.1:8000", $errno, $errstr);
if (!$socket) {
die("$errstr ($errno)\n");
}
$connects = array();
<?php
function parseRawHttpRequest(array &$arrayData) {
$input = file_get_contents('php://input');
preg_match('/boundary=(.*)$/', $_SERVER['CONTENT_TYPE'], $matches);
if (!count($matches)) {
// parse_str(urldecode($input), $arrayData);
parse_str($input, $arrayData);
<?php
/* This is daniel664's karma bot, fixed and stabilised by goeo_.
* It was a w_b_e fork anyway
*/
set_time_limit(0);
error_reporting(0);
date_default_timezone_set('Europe/Istanbul');
$server = "irc.freenode.org";
$nick = "jbqakarmabot";
<?php
if(!file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])){
$_GET['_url'] = $_SERVER['REQUEST_URI'];
}
return false;