Skip to content

Instantly share code, notes, and snippets.

View RDelorier's full-sized avatar

Ricky Delorier RDelorier

  • United States
  • 09:47 (UTC -12:00)
View GitHub Profile
_ssh()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(grep '^Host' ~/.ssh/config ~/.ssh/config.d/* 2>/dev/null | grep -v '[?*]' | cut -d ' ' -f 2-)
COMPREPLY=( $(compgen -W "$opts" -- ${cur}) )
return 0
@RDelorier
RDelorier / install.sh
Last active October 24, 2017 13:26
Install Dotfiles
git clone --bare https://github.com/RDelorier/dotfiles.git $HOME/.cfg
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
mkdir -p .config-backup
config checkout
if [ $? = 0 ]; then
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 959 593" width="959" height="593">
<title>Blank US states map</title>
<g id="outlines">
<path id="AK" fill="#D3D3D3" d="M161.1,453.7 l-0.3,85.4 1.6,1 3.1,0.2 1.5,-1.1 h2.6 l0.2,2.9 7,6.8 0.5,2.6 3.4,-1.9 0.6,-0.2 0.3,-3.1 1.5,-1.6 1.1,-0.2 1.9,-1.5 3.1,2.1 0.6,2.9 1.9,1.1 1.1,2.4 3.9,1.8 3.4,6 2.7,3.9 2.3,2.7 1.5,3.7 5,1.8 5.2,2.1 1,4.4 0.5,3.1 -1,3.4 -1.8,2.3 -1.6,-0.8 -1.5,-3.1 -2.7,-1.5 -1.8,-1.1 -0.8,0.8 1.5,2.7 0.2,3.7 -1.1,0.5 -1.9,-1.9 -2.1,-1.3 0.5,1.6 1.3,1.8 -0.8,0.8 c0,0 -0.8,-0.3 -1.3,-1 -0.5,-0.6 -2.1,-3.4 -2.1,-3.4 l-1,-2.3 c0,0 -0.3,1.3 -1,1 -0.6,-0.3 -1.3,-1.5 -1.3,-1.5 l1.8,-1.9 -1.5,-1.5 v-5 h-0.8 l-0.8,3.4 -1.1,0.5 -1,-3.7 -0.6,-3.7 -0.8,-0.5 0.3,5.7 v1.1 l-1.5,-1.3 -3.6,-6 -2.1,-0.5 -0.6,-3.7 -1.6,-2.9 -1.6,-1.1 v-2.3 l2.1,-1.3 -0.5,-0.3 -2.6,0.6 -3.4,-2.4 -2.6,-2.9 -4.8,-2.6 -4,-2.6 1.3,-3.2 v-1.6 l-1.8,1.6 -2.9,1.1 -3.7,-1.1 -5.7,-2.4 h-5.5 l-0.6,0.5 -6.5,-3.9 -2.1,-0.3 -2.7,-5.8 -3.6,0.3 -3.6,1.5 0.5,4.5 1.1,-2.9 1,0.3 -
@RDelorier
RDelorier / parse-slow-log.sh
Created August 8, 2017 15:02 — forked from JCotton1123/parse-slow-log.sh
Parse php-fpm slow log
## Slow requests grouped by function call
cat /var/log/php-fpm/www-slow.log | grep -A 1 script_filename | \
grep -v script_filename | grep -v -e "--" | cut -c 22- | sort | uniq -c | sort -nr
## Slow requests grouped by minute
cat /var/log/php-fpm/www-slow.log | grep 'pool www' | \
cut -d' ' -f2 | sort | cut -d: -f1,2 | uniq -c
## Top 25 1 minute groups of slow requests
cat /var/log/php-fpm/www-slow.log | grep 'pool www' | cut -d' ' -f2 | \
@RDelorier
RDelorier / .gitconfig
Created July 6, 2017 18:33
My Dotfiles
[user]
email = rdelorier@gmail.com
name = Ricky Delorier
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lg2 = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
[core]
excludesfile = /Users/rdelorier/.gitignore_global
@RDelorier
RDelorier / AccessToken.php
Created January 27, 2017 21:12
Passport jwt additional claims
<?php
namespace App\Auth;
use Laravel\Passport\Bridge\AccessToken as BaseToken;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Signer\Key;
use Lcobucci\JWT\Signer\Rsa\Sha256;
use League\OAuth2\Server\CryptKey;
use League\OAuth2\Server\Entities\ClientEntityInterface;
<?php
namespace App\Traits;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
trait TransformsViaFractal
{
/**
* Convert current item into a fractal instance.
<template>
<div class="quill-editor">
<!-- Create toolbar container -->
<div id="toolbar" ref="toolbar" @click.prevent>
<select class="ql-size">
<option value="small"></option>
<option selected></option>
<option value="large"></option>
<option value="huge"></option>
</select>
<?php
namespace App\Models\Relations;
use Illuminate\Database\Eloquent\Relations\HasOne;
class HasOneScoped extends HasOne
{
protected $attributes = [];
@RDelorier
RDelorier / encrypt.php
Last active January 20, 2016 17:00
Laravel compatible encrypt method
<?php
/**
* Encrypts the value in a way compatible with laravel 5.1
* @param $value value to encrypt
*
* @return string
*/
function encrypt($value)
{