Skip to content

Instantly share code, notes, and snippets.


Oanh Nguyen oanhnn

View GitHub Profile
themsaid / AppServiceProvider.php
Created Jan 26, 2020
Re-encryption after APP_KEY rotation
View AppServiceProvider.php
namespace App\Providers;
use App\Encrypter;
use Illuminate\Support\Str;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
oanhnn /
Last active Mar 27, 2019
LEMP provider scripts
#!/bin/bash -ex
addgroup dev
adduser --disabled-password --ingroup dev $SSHUSER
usermod -aG sudo $SSHUSER
mkdir -p /home/$SSHUSER/.ssh
rsperl / Makefile #snippet
Last active Jul 29, 2022
self-documenting makefile with colors
View Makefile #snippet
# to see all colors, run
# bash -c 'for c in {0..255}; do tput setaf $c; tput setaf $c | cat -v; echo =$c; done'
# the first 15 entries are the 8-bit colors
# define standard colors
ifneq (,$(findstring xterm,${TERM}))
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
calebporzio / PreviewOfUpcomingPackage.php
Last active Apr 28, 2022
A model trait that allows child models to use parent table names and relationship keys.
View PreviewOfUpcomingPackage.php
namespace App\Abilities;
use Illuminate\Support\Str;
use ReflectionClass;
* Note: This is a preview of an upcoming package from Tighten.
View subscriptions.opml
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<title>Subscriptions -</title>
<outline text="PHP" title="PHP">
<outline htmlUrl="" title="" xmlUrl="" type="rss" text=""/>
<outline htmlUrl="" title="" xmlUrl="" type="rss" text=""/>
<outline title="" xmlUrl="" type="rss" text=""/>
dylanscott /
Last active May 30, 2017
Travis Update to Docker 1.13
#!/usr/bin/env bash
set -euo pipefail
sudo sh -c 'echo "deb ubuntu-$(lsb_release -cs) main" > /etc/apt/sources.list.d/docker.list'
curl -fsSL | sudo apt-key add -
sudo apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-get update
sudo apt-get -y install "docker-engine=1.13.1-0~ubuntu-$(lsb_release -cs)"
santoshachari / Laravel PHP7 LEMP
Last active Jul 12, 2021
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x
View Laravel PHP7 LEMP

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
mathewdgardner /
Created Mar 1, 2016
Save / load compressed docker images
# Save docker images
ds() {
docker images | \
cut -d ' ' -f 1 | \
tail -n +2 | \
xargs -t -n 1 -I {} -P 4 \
sh -c 'docker save {} | bzip2 > $(echo "{}" | sed "s/^.*\///").tar.bz2'
oanhnn /
Last active Aug 11, 2022
Using multiple github accounts with ssh keys


I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).


Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
leroy / Gulpfile.js
Created Nov 21, 2015
My Phaser gulp workplace
View Gulpfile.js
var gulp = require('gulp');
var gutil = require('gulp-util');
var source = require('vinyl-source-stream');
var buffer = require('gulp-buffer');
var babelify = require('babelify');
var browserify = require('browserify');
var browserSync = require('browser-sync');
var ROOT_PATH = "."
var PHASER_PATH = ROOT_PATH + '/node_modules/phaser/build/';