Skip to content

Instantly share code, notes, and snippets.

View fideloper's full-sized avatar
Working from home

Chris Fidao fideloper

Working from home
View GitHub Profile
fideloper /
Last active July 15, 2024 17:59
Certbot on Ubuntu, wildcard subdomains via CloudFlare DNS challenge
# Used on Ubuntu 18.04 and 20.04
# Find instructions for other OSes here:
# Install Certbot via Snaps
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
# Install DNS CloudFlare plugin
sudo snap set certbot trust-plugin-with-root=ok
fideloper /
Last active June 28, 2024 11:01
Find, format, and mount an AWS Ephemeral NVMe disk within ec2 in user data
#!/usr/bin/env bash
## This mounts a (single) ephemral NVMe drive in an EC2 server.
## It's meant to be run once, within user-data
## For EBS drives (non-ephemeral storage), see:
fideloper / .zshrc
Created June 21, 2019 00:35
Defer loading of NVM to increase new terminal init speed
# Thanks to, modified
# for zsh as "type -t" works in bash but not zsh
# Add this to your .zshrc ...
# Defer initialization of nvm until nvm, node or a node-dependent command is
# run. Ensure this block is only run once if .bashrc gets sourced multiple times
# by checking whether __init_nvm is a function.
if [ -s "$HOME/.nvm/" ] && [ ! "$(type -w __init_nvm | awk '{print $2}')" = function ]; then
fideloper /
Last active June 17, 2024 11:58
Create vHost Ubuntu Lamp-Server (bash and python)
#! /usr/bin/python
from sys import argv
from os.path import exists
from os import makedirs
from os import symlink
from os import system
import getopt
fideloper / SlackActionController.php
Created February 6, 2024 15:01
Verify Slack webhooks in Laravel
namespace App\Http\Controllers\Slack;
use App\Slack\Webhook;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
fideloper / k8s.yaml
Created June 2, 2024 18:24
thats bait dot gif
apiVersion: v1
kind: Namespace
labels: ingress-nginx ingress-nginx
name: ingress-nginx
apiVersion: v1
automountServiceAccountToken: true
fideloper / stream_file.php
Last active May 22, 2024 20:50
Stream file from S3 to browser, assume Laravel Filesystem usage
* Get File Information
// Assuming these come from some data source in your app
$s3FileKey = 's3/key/path/to/file.ext';
$fileName = 'file.ext';
fideloper / ngxdis
Created January 4, 2014 22:25
Nginx scripts for enable and disabling a site. This will create or destroy a symlink between a real config file in /etc/nginx/sites-available and a symlink in /etc/nginx/sites-enabled.
#!/usr/bin/env bash
if [ $EUID -ne 0 ]; then
echo "You must be root: \"sudo ngxdis\""
exit 1
# -z str: Returns True if the length of str is equal to zero.
if [ -z "$1" ]; then
echo "Please choose a site."
fideloper /
Last active February 19, 2024 18:09
Microsoft Graph API - oAuth apps with PHP and JWT certification authentication

Microsoft Graph API - oAuth apps with PHP and JWT certification authentication

If you've ever wanted to create an oAuth style application with Microsoft, you might have felt this pain before.

In true Enterprise Microsoft Fashion™, there's a lot going on.

This will be a bit long because of that. I hope I haven't missed anything (but I'm sure I have)!

We'll be using PHP (Laravel in my case).

fideloper /
Last active January 11, 2024 15:23
Update curl on Ubuntu 14.04
#! /usr/bin/env bash
# Install any build dependencies needed for curl
sudo apt-get build-dep curl
# Get latest (as of Feb 25, 2016) libcurl
mkdir ~/curl
cd ~/curl
tar -xvjf curl-7.50.2.tar.bz2