Skip to content

Instantly share code, notes, and snippets.

View jeffwray's full-sized avatar

Jeffrey Wray jeffwray

View GitHub Profile
@jeffwray
jeffwray / 2019_11_03_081136_alter_all_table_id.php
Created July 28, 2023 21:57 — forked from afiqiqmal/2019_11_03_081136_alter_all_table_id.php
Migrate bigIncrements to increments with foreign key attached
<?php
/**
* Created by PhpStorm.
* User: hafiq
* Date: 03/11/2019
* Time: 11:36 PM
*/
use Illuminate\Support\Facades\Schema;
@jeffwray
jeffwray / Message-Queue-Processing_Msg_Per_Hr.sql
Last active December 9, 2021 03:56
Message Queue Processing - Determining the number of messages processed in an hour
SELECT DAY ( processed_on ) AS DAY,
HOUR ( processed_on ) AS HOUR,
count( id ) AS Count
FROM
messages
WHERE
processed_on BETWEEN :start_date AND :end_date
GROUP BY
DAY ( processed_on ),
HOUR ( processed_on )
@jeffwray
jeffwray / README.md
Created September 17, 2021 02:25 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@jeffwray
jeffwray / UuidModel.php
Created May 26, 2017 14:33 — forked from danb-humaan/UuidModel.php
Trait for implementing UUIDs in Laravel models
<?php
namespace App\Traits;
use Rhumsaa\Uuid\Uuid;
use Illuminate\Database\Eloquent\ModelNotFoundException;
/**
* Trait UuidModel
* @package App\Traits
@jeffwray
jeffwray / sendTxt.md
Created March 30, 2017 13:12
Because I care but get busy and might forget to send you a text

Ever get caught up in a project at work and forget to text that special someone? This Apple Script can help you remember.

Directions:

  1. Have your phone/imessanger connected to your mac.
  2. Open Script Editor
  3. Paste following code into editor, remember to change prompt and phone number. Recommend to test before running it in the wild.
  4. Set up a cron job in crontab to run script when you specify.
@jeffwray
jeffwray / DB.sql
Last active August 29, 2015 14:13 — forked from msurguy/DB.sql
CREATE TABLE `makers` (
`id` int(10) unsigned NOT NULL,
`name` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
function send_remote_syslog($message, $component = "web", $program = "next_big_thing") {
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
foreach(explode("\n", $message) as $line) {
$syslog_message = "<22>" . date('M d H:i:s ') . $program . ' ' . $component . ': ' . $line;
socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, 'logs.papertrailapp.com', MY_PORT);
}
socket_close($sock);
}
send_remote_syslog("Test");
@jeffwray
jeffwray / API.md
Created October 2, 2013 13:38 — forked from iros/API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method: