Skip to content

Instantly share code, notes, and snippets.

View salathe's full-sized avatar
🐮
🔥

Peter Cowburn salathe

🐮
🔥
  • Akamai Technologies
  • Edinburgh, Scotland
View GitHub Profile
salathe@php3:~# echo '<?php $str="example"; var_dump($str[1]); ?>' | ./php
X-Powered-By: PHP/3.0.18
Content-type: text/html
string(1) "x"
root@4a7e05606bd1:/# cat foo.php
<?php
class MySocketServer { function run() {} }
(new MySocketServer)->run();
root@4a7e05606bd1:/# php foo.php
root@4a7e05606bd1:/# echo $?
0
@salathe
salathe / gist:8317870
Last active January 2, 2016 14:39 — forked from J7mbo/gist:8317804
/**
* {@inheritdoc}
*
* @note Image dimensions returned as array(width, height)
*/
public function fetchMetaDataFrom($filePath)
{
if (!file_exists($filePath))
throw new MetaDataFileNotFoundException(sprintf("File %s could not be found for metadata retrieval", $filePath));
<?php
function ☃() { var_dump(__FUNCTION__); }
☃();
@salathe
salathe / nginx.conf
Created October 21, 2013 16:20 — forked from vessi/nginx.conf
# available in /etc/nginx/nginx.conf
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
root@php1box:/tmp/php# ./phpf.cgi
Content-type: text/html
<html><head><title>PHPF Usage</title></head><body>
<center><h1>PHPF Usage</h1></center>
Call <i>phpf.cgi</i> with a url like <tt>http://host@domain/~user/phpf.cgi?arg</tt> where arg is one of:<br>
<pre> <tt>form+dest_url</tt></pre>
</body></html>
<?php
namespace Seedstream;
use React\EventLoop\LoopInterface,
React\Socket\ConnectionInterface;
class Pusher
{
private $loop;
@salathe
salathe / list.php
Last active December 18, 2015 18:29 — forked from evert/list.php
<?php
$var = "foo";
list($foo, $bar, $baz) = $var;
var_dump($foo, $bar, $baz);
list($foo, $bar, $baz) = "foo";
var_dump($foo, $bar);
/*
<?php
while (TRUE) {
$microtime = microtime(true);
$date = DateTime::createFromFormat('U.u', $microtime);
if (!$date) {
var_dump($microtime, (string) $microtime);
exit;
}
}
<?php
class ╯°□°)╯︵┻━┻ extends Exception { }
throw new ╯°□°)╯︵┻━┻;