Skip to content

Instantly share code, notes, and snippets.

View deffjay's full-sized avatar

Jeff Day deffjay

View GitHub Profile
@deffjay
deffjay / phpfpm_swoole_benchmark.md
Last active March 4, 2024 01:54
PHP-FPM / Swoole Benchmarks

PHP-FPM / Swoole - Performance Comparison!

Here are some comparative benchmarks of our API using PHP-FPM vs Laravel Octane (Swoole) endpoints.

Test Hardware - Setup

  • Macbook Pro (15-inch, 2018) - 2.6 GHz 6-Core Intel Core i7. 32 GB 2400 Mhz
  • MySQL - 8.0
  • PHP - 8.0.3
  • Laravel - 8.83.5
@viezel
viezel / test-octane.md
Last active April 22, 2023 00:47
Quick Laravel Octane test - UPDATED

Intro

I wanted to quickly take Laravel Octane beta for a spin, as we have been using Swoole for some time and wanted to see how official support performs vs what we have.

Test 2: Forge server

Next test is more real world as we now have a web server and database server within a VPC.

Using Laravel Forge

@deffjay
deffjay / installing_clockwork_for_laravel.md
Last active July 18, 2020 07:13
Install clockwork profiling library for Laravel > 5.5

Install the Clockwork library via Composer.

$ composer require itsgoingd/clockwork --dev

If you are running the latest Laravel version, congratulations you are done!

By default, Clockwork will only be available in debug mode, you can change this and other settings in the configuration file. Use the vendor:publish Artisan command to publish the configuration file into your config directory.

@jamietre
jamietre / pc-rules.erb
Last active February 16, 2024 10:51
Karabiner Elements config to map home/end keys to PC-like behavior on MacOS X
{
"title": "MacOS -> PC Shortcuts",
"rules": [
{
"description": "Top/bottom of document (ctrl+home/ctrl+end)",
"manipulators": [
{
"type": "basic",
"from": <%= from("home", ["command"], ["any"]) %>,
"to": <%= to([["up_arrow", ["left_command"]]]) %>,

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@deffjay
deffjay / CentOS Web Server Firewall Config
Last active December 20, 2015 18:59
How to open up the firewall to allow port 80 (HTTP), 443 (HTTPS) and port 22 (SSH) for CentOS
# vim /etc/sysconfig/iptables
#
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
@jaygooby
jaygooby / percona-xtrabackup.sh
Last active May 9, 2022 15:43
Call via crontab on whatever schedule suits you; keep n full mysql Percona xtrabackups of your mysql database, with binary logs applied. Also does a full mysqldump that can then have the binary logs applied to restore to a point-in-time backup via the binlogs. Copy all of this (backup, mysqldump, binlogs) to S3.
#!/bin/bash
#
# Carries out a full mysqldump, calls percona-xtrabackup and then
# copies the sql dump, the percona backup and your mysql bin logs
# to S3 using s3cmd http://s3tools.org/s3cmd
#
# TODO: extract out the S3 backup stuff to make it optional, and so
# other s3 programs can replace the s3cmd call.
# TODO: the if [ $? == 0 ] alert blocks should be a function
# TODO: make the if [ $? == 0 ] if [ $? != 0 ] more consistent - test
@jedp
jedp / gist:1894029
Created February 23, 2012 17:54
example node.js event emitter
var util = require('util');
var events = require('events');
var redis = require('redis');
var RedisQueueConsumer = function (port, host) {
events.EventEmitter.call(this);
this.port = port || 6379;
this.host = host || '127.0.0.1';
};
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active April 2, 2024 20:18
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version