Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Durham rydurham

View GitHub Profile
@rydurham
rydurham / deployment.sh
Last active Dec 18, 2020
Forge Deployment Script for Elixir Applications
View deployment.sh
cd /home/forge/www.example.com
# Fetch the latest version of the code
git pull origin deploy
# Ensure we have access to mix
if ! [ -x "$(command -v mix)" ]; then
echo 'Error: Elixir is not installed.' >&2
exit 1
fi
@rydurham
rydurham / print_array.php
Last active May 28, 2020
Print a PHP array so that it can be copied into source code
View print_array.php
<?
foreach($this->parser->getRecords() as $ref => $record) {
echo "'{$ref}' => [\n";
foreach($record as $key => $value) {
if (is_float($value)) {
echo " '{$key}' => {$value},\n";
} else {
echo " '{$key}' => '{$value}',\n";
@rydurham
rydurham / part1.exs
Created Dec 13, 2019
Advent Day 8 - Part 1 - WIP
View part1.exs
defmodule Day8 do
@input "22022222022220021222222102222222222222222202012220222121222012222212222122222222222222222222202222222221222220222222222212220222222222221222200222222222222222222222022222222122222222222222222212002220222021222222222202222222222222222222222222212222222222222222222222222202221222222222220222202222222222012222022222021222222202222222222222222212012221222221222202222202222222222222222222222222212222222222222221222222222202222222222222222222200222222222112222122220220222222022222222222222222202212221222122222202222202222122222222222222222222212222222222222220222222222212222222222222220222202222222222222222122221020222222202222222222222222222212222222121222202222222222122222222222222222222212222222220222220222222222202222222222222221222211222222222212222122221020222222212222222222222222210122222222220222012222202222222222222220222222222202222222221222220222222222222220222222222222222222222222222012222122221020222222122222222022222222211012220222020222202222222222122222222221222222222202
@rydurham
rydurham / Gemfile
Created Aug 11, 2019
Rake with AWS Glacier
View Gemfile
source 'https://rubygems.org'
gem 'aws-sdk', '3.0.1'
gem 'irb', '1.0.0'
gem 'rake', '12.3.1'
gem 'tilt', '2.0.8'
View A few VS Code Keybindings
{
"key": "ctrl+alt+w",
"command": "workbench.action.closeAllEditors"
},
{
"key": "ctrl+alt+q",
"command": "workbench.files.action.collapseExplorerFolders"
},
{
"key": "ctrl+shift+t",
@rydurham
rydurham / .php_cs
Last active May 1, 2019
Laravel PHP CS config
View .php_cs
<?php
$finder = Symfony\Component\Finder\Finder::create()
->exclude('vendor')
->exclude('bootstrap')
->exclude('storage')
->in(__DIR__)
->name('*.php')
->notName('*.blade.php');
View .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@rydurham
rydurham / Model.php
Last active Aug 11, 2020
Eloquent Model Stub
View Model.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Flight extends Model
{
/**
* The table associated with the model.
View forge_php_extensions
$ php --version
PHP 7.0.28-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.28-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies
$ php -m
[PHP Modules]
@rydurham
rydurham / provisioning.sh
Last active Feb 9, 2021
Ubuntu Provisioning
View provisioning.sh
# /home partition
# https://help.ubuntu.com/community/Partitioning/Home/Moving
# Basics
sudo apt update
sudo apt install curl vim git libpng-dev
sudo apt remove apache2
# Remove snapd
# https://askubuntu.com/questions/1035915/how-to-remove-snap-store-from-ubuntu