Skip to content

Instantly share code, notes, and snippets.

Ben Ramsey ramsey

Block or report user

Report or block ramsey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ramsey / openapi.yaml
Last active Sep 26, 2019
OpenDISCO OpenAPI Document WIP
View openapi.yaml
openapi: 3.0.2
title: DISCO Server
version: 'v1.0.0'
- url:
ramsey /
Last active Dec 11, 2018
Queries AWS Route53 for a zone name and outputs a zone file of its records
# Queries AWS Route53 for a zone name and outputs a zone file of its records
# Usage:
# r53export[ profile]
# By default, uses $AWS_PROFILE environment variable, if set.
ramsey / foo.php
Created Oct 16, 2017
Segfault when running built-in PHP web server
View foo.php
class Foo
public function execute($log)
file_put_contents($log, "this is a log\n", FILE_APPEND);
(new Foo())->execute('./mylog.txt');
ramsey / authenticate.php
Last active Sep 28, 2017
Demonstrate that Apache converts any response containing WWW-Authenticate to 401
View authenticate.php
header('HTTP/1.1 403 Forbidden');
if (isset($_GET['authHeader']) && $_GET['authHeader'] == 1) {
header('WWW-Authenticate: Bearer realm="Foo"');
echo "Hi!";
ramsey / cycle-list.php
Created Sep 1, 2017 — forked from chartjes/cycle-list.php
My PHP script for creating a Twitter list where people cycle on and off it based on 30 days of interaction
View cycle-list.php
require "vendor/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;
// You can get all these via
$consumer_key = "";
$consumer_secret = "";
$access_token = "";
$access_token_secret = "";
$user_id = 0; // Twitter user ID

Running Xhgui With Tideways Through a Docker Container

Run Xhgui Docker Container

cd ~
git clone
docker run --name xhgui -d -p 8880:80 -P -v "$HOME/xhgui":/var/www/xhgui clarencep/xhgui
docker exec xhgui bash -c 'cd /var/www/xhgui && \
    curl --silent | php -- --quiet && \
View run_bm.php
shell_exec('ssh debian sudo service hhvm stop');
function parse_siege($data) {
preg_match("#(\d+\.\d+) trans/sec#",$data,$m);
$rps = $m[1];
preg_match("#Response time:\s*(\d+\.\d+) secs#",$data,$m);
$lat = $m[1];

Thinking this to be a powerline issue related to, I originally posted the following at

Thanks so much to Trent Harvey and @ZyX-I for their help working through this. (Twitter thread.)

I just encountered this problem. I'm not sure what causes it, since I've been using my terminal configuration for years without this issue. I did not install or upgrade any software today. Rebooting my machine did not fix it.

I'm running:

ramsey / uuid.php
Created Oct 26, 2016
Creating an ordered time UUID alongside a timestamp-first COMB UUID.
View uuid.php
// composer require ramsey/uuid moontoast/math
require_once 'vendor/autoload.php';
use Ramsey\Uuid\Codec\OrderedTimeCodec;
use Ramsey\Uuid\Codec\TimestampFirstCombCodec;
use Ramsey\Uuid\Generator\CombGenerator;
use Ramsey\Uuid\UuidFactory;
ramsey / variadic-generics.php
Created Oct 13, 2016
You may type-hint on variadic functions in PHP to enforce type on elements in the array
View variadic-generics.php
class Foo {}
$f1 = new Foo();
$f2 = new Foo();
$bar = function (Foo ...$foo) {
foreach ($foo as $f) {
echo get_class($f) . "\n";
You can’t perform that action at this time.