Skip to content

Instantly share code, notes, and snippets.

View davidpeach's full-sized avatar
🖥️
I use Arch btw

David Peach davidpeach

🖥️
I use Arch btw
View GitHub Profile
@davidpeach
davidpeach / WebmentionsController.php
Last active August 29, 2015 14:22
My Laravel 5 Webmention Controller from my personal website. This file handles both the receiving of webmentions and then their later conversion into comments / mentions on my site.
<?php namespace App\Http\Controllers;
use App\Mention;
use App\Webmention;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
use Mf2\Parser as Mf2Parser;
@davidpeach
davidpeach / ApiController.php
Last active August 29, 2015 14:23
Contains the functionality for parsing a Google Play Music URL for keeping track of albums I listen to. See http://davidpea.ch/articles/671 for the full post.
<?php
namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use JonnyW\PhantomJs\Client;
use App\Listening;
use DB;
@davidpeach
davidpeach / Material-Theme.sublime-theme 1 of 2
Last active August 31, 2015 10:09
My full, edited Material theme preferences file. ## In Two Parts ##
[
/* @ EMPTY WINDOW
* Style for empty (no tabs) window
========================================================================= */
{
"class": "sheet_container_control",
"layer0.tint": [38, 50, 56],
"layer0.opacity": 1.0
@davidpeach
davidpeach / .vimrc
Created February 9, 2016 00:52
My .vimrc file - early stages,
syntax enable
colorscheme desert
set backspace=indent,eol,start "Make backspace act like text editors
let mapleader = ',' "Make default leader key be comma
set number "Show line numbers
"------------- Mappings -------------"
@davidpeach
davidpeach / gist:b78b8d80cf5c17fd2613d7cc138c8cde
Created October 23, 2018 19:11
An example follow request sent from mastodon to my test ActivityPub site
{
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"manuallyApprovesFollowers":"as:manuallyApprovesFollowers",
"sensitive":"as:sensitive",
"movedTo":
{
"@id":"as:movedTo",
@davidpeach
davidpeach / cloud_config.yaml
Created August 12, 2020 19:42 — forked from MakersF/cloud_config.yaml
#cloud-config for Python application with Postgresql database and read_only role for DigitalOcean
#cloud-config
users:
- name: demo_user
shell: /bin/bash
ssh-authorized-keys:
- ssh-rsa [your -key]
packages:
- git
#cloud-config
packages:
- nginx
#jq is a command-line json processor https://stedolan.github.io/jq/
- jq
- unattended-upgrades
runcmd:
- export DOMAIN=your_domain_here.com
- export DO_API_TOKEN=PASTE_YOUR_DIGITALOCEAN_API_TOKEN_HERE
- export PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address)
@davidpeach
davidpeach / wp-disable-emojis-plugin.php
Created September 22, 2020 20:42
Disable Emojis in WordPress (Stop the connection to w.org through emojis link)
<?php
/*
Plugin Name: Disable Emojis
Plugin URI: https://davidpeach.co.uk
Description: Stop the connection to w.org through emojis
Version: 1.0.0
Author: David Peach
Author URI: https://davidpeach.co.uk
License: GNU
*/
<?php
namespace Tests\Feature;
use App\Models\Post;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
# When hitting the websocket endpoint, the key generated seems to often get messed up.
# Sometimes like this:
883a ff42 4864 0162 8659 a29b 3900 73e4
3fff 9634 11dd 4285 fefc 3d4a ff63 6fd5
# More often like this:
³B1¿Ç?Àam¢å¡öY9ì©zŒ uö1ve‹…µ