Skip to content

Instantly share code, notes, and snippets.

View ElliottLandsborough's full-sized avatar

Elliott Lan ElliottLandsborough

View GitHub Profile
@ElliottLandsborough
ElliottLandsborough / motw.php
Last active September 2, 2015 09:23
X-Files Monster of the Week Episodes Array
<?php
/*
* X Files Episode Range
*/
$episodes = array();
$episodes[1] = array(0,23); // Sometimes $episodes[1] = array(1,24); (depends on pilot numbering)
$episodes[2] = array(1,25);
@ElliottLandsborough
ElliottLandsborough / 1337.coffee
Created December 3, 2015 14:28
Hubot: Let the channel know that it is 13.37
# Description:
# 1337 Notify
#
# Dependencies:
# "cron": "^1.0.9",
# "time": "^0.11.3",
#
# Configuration:
# None
#
### Keybase proof
I hereby claim:
* I am ElliottLandsborough on github.
* I am elliottlan (https://keybase.io/elliottlan) on keybase.
* I have a public key whose fingerprint is BF4E 87B4 21C3 B2D7 2F58 401A DE96 E600 6A17 EB88
To claim this, I am signing this object:
Would you rather?
## Rules
- Split everyone into groups of 3-5.
- Fill bag with printed questions.
- Each group chooses a question, they are allowed to swap but not allowed to look.
- Come up with at least 2 justifications.
- After 5 minutes, a member of the group will tell the room their question and their justifications.
- If anyone thinks that the decision was wrong they are allowed to say why.
<?php
namespace App\Providers;
use Illuminate\Http\Request;
use Illuminate\Support\ServiceProvider;
use Blade;
class AppServiceProvider extends ServiceProvider
{
@ElliottLandsborough
ElliottLandsborough / login.php
Created September 20, 2017 14:40
Ejabberd XMLRPC User/Pass login test
<?php
$params = ['user' => $request->username, 'host' => $this->host, 'password' => $request->password ];
$request = xmlrpc_encode_request('check_password', $params, ['encoding' => 'utf-8', 'escaping' => 'markup']);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->server);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@ElliottLandsborough
ElliottLandsborough / blocks.sh
Last active December 7, 2017 18:12
Count downloaded bitcoin blocks
#!/bin/bash
total=$(wget -O - http://blockchain.info/q/getblockcount 2>/dev/null)
while true ; do
clear
echo "Press enter to break loop. Script will loop every 3 seconds"
echo "If loop freezes press CTRL+C"
echo ""
item=$(bitcoin-cli getblockcount 2>&1)
echo -e " \033[31mdownloaded\e[0m/\033[32mavailable\e[0m"
echo -e " \033[31m${item}\e[0m"/"\033[32m${total}\e[0m"
@ElliottLandsborough
ElliottLandsborough / process.php
Last active February 3, 2018 20:52
xml modify
<?php
# how to use:
# 1. install php
# 2. Put start.xml in the same folder as process.php
# 3. Open terminal and cd to the folder with process.php in it
# 4. run in terminal: php process.php
# 5. See results in finish.xml
$dom = new DOMDocument(); //init
@ElliottLandsborough
ElliottLandsborough / respond.php
Last active November 16, 2018 16:27
PHP Respond with specified HTTP status
<?php
/**
* accept an HTTP status code as a get variable and return it in the response
*
* Usage: respond.php?status=404
*/
// https://github.com/symfony/http-foundation/blob/master/Response.php
$statusTexts = [
100 => 'Continue',
@ElliottLandsborough
ElliottLandsborough / composer.json
Created March 8, 2019 09:55
Wordpress composer example
{
"name": "ElliottLandsborough/project-name",
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
}
],
"require": {
"php": ">=5.6",