Skip to content

Instantly share code, notes, and snippets.

View codyphobe's full-sized avatar
🏍️
Chasing the sunset

Cody codyphobe

🏍️
Chasing the sunset
View GitHub Profile
@codyphobe
codyphobe / HasUuid.php
Created July 10, 2018 07:00 — forked from calebporzio/HasUuid.php
A little trait to add to models that will have Uuids
<?php
// Example usage in a model:
class ExampleModel extends Model
{
use HasUuid;
protected $primaryKey = 'uuid';
@codyphobe
codyphobe / in-memory-sqlite-database.php
Created September 26, 2017 22:36 — forked from reinink/in-memory-sqlite-database.php
Give users completely safe sandboxed raw SQL reporting abilities
<?php
// Create in-memory SQLite database
$sqlite = new PDO('sqlite::memory:');
// Generate schema (for whatever tables you want)
$sqlite->prepare('CREATE TABLE users(id, family_id, first_name, last_name, email)')->execute();
$sqlite->prepare('CREATE TABLE families(id, name, phone, address)')->execute();
// Insert pre-defined data
@codyphobe
codyphobe / _readme.md
Created August 15, 2017 05:04 — forked from BenTech2/_readme.md
PretendYoureXyzzy Server Installation

WARNING: This guide is still being written... after 3 days of research and trial/error i have setup a working server and now am shareing the process since theres no documentation on the internet for it.

How To Setup a PretendYoureXyzzy Server

Ubuntu 14.04 Server or Desktop

NOTE - you will need a linux (or M$ windows, but i could not get it tomcat emulator to work) GUI environment for eclipse to build the WAR file for the server, unless you plan to use Ubuntu Desktop for the server.

Setup the Tomcat Server

@codyphobe
codyphobe / delete-all-discord-messages.js
Created August 1, 2017 23:09
Deleting every message from a channel using DiscordJS
const client = new Discord.Client();
client.on('message', msg => {
let deleteStuff = () => {
let count = 0;
msg.channel.fetchMessages({limit: 100})
.then(messages => {
let messagesArr = messages.array();
let messageCount = messagesArr.length;
@codyphobe
codyphobe / SearchThreads.php
Created July 20, 2017 22:15 — forked from driesvints/SearchThreads.php
Multiple method query objects
<?php
namespace App\Queries;
use App\Models\Thread;
use Illuminate\Contracts\Pagination\Paginator;
class SearchThreads
{
public function __construct()
@codyphobe
codyphobe / SearchThreads.php
Created July 20, 2017 22:15 — forked from driesvints/SearchThreads.php
Invokable query object
<?php
namespace App\Queries;
use App\Models\Thread;
use Illuminate\Contracts\Pagination\Paginator;
class SearchThreads
{
public function __construct()
@codyphobe
codyphobe / UuidTrait.php
Created June 13, 2017 21:12 — forked from hongaar/UuidTrait.php
Laravel UuidTrait for Eloquent
<?php
use Rhumsaa\Uuid\Uuid;
trait UuidTrait
{
/**
* Boot the Uuid trait for the model.
*
* @return void
@codyphobe
codyphobe / FetchGitHubTotals.php
Created May 29, 2017 02:00 — forked from mpociot/FetchGitHubTotals.php
GitHub component for the excellent Spatie dashboard package from https://github.com/spatie/dashboard.spatie.be
<?php
namespace App\Components\GitHub;
use App\Events\GitHub\FileContentFetched;
use App\Events\GitHub\TotalsFetched;
use GitHub;
use Illuminate\Console\Command;
class FetchGitHubTotals extends Command
@codyphobe
codyphobe / openpgp-card-guide.md
Created May 22, 2017 00:19 — forked from ageis/openpgp-card-guide.md
Quick GPG Smartcard Guide

Quick GPG Smartcard Guide

We will generate a master key with only the Certify capability and three subkeys with each of the Sign, Encrypt and Authenticate capabilities. These latter three keys are meant for daily use and will be transferred to an OpenPGP smartcard, which has three corresponding slots. The master private key can then be moved to offline cold storage, or stored on a second smartcard.

We are generating keys on a secure computer instead of on the card, because it allows more flexibility. Ideally this means a machine running Tails or one that is air-gapped and not connected to the internet.

This guide assumes that if you want to sign other peoples keys, then you will require the aforementioned secondary smartcard with your master key stored in its Signature slot, or if you only have one smartcard, then you'll have to fetch the master key out of cold storage. By default, GPG generates a master key with the Certify and