Skip to content

Instantly share code, notes, and snippets.

View Success-Guy's full-sized avatar
Working from home

Abiodun Aworeni Success-Guy

Working from home
View GitHub Profile
Success-Guy / Cloudfront-function-to-handle-NextJS-requests.js
Last active January 15, 2024 09:50
Cloudfront function to handle NextJS requests of multi-level with get param to the right files
function handler(event) {
var request = event.request;
var rawurl = request.uri;
var url = rawurl.split('?')[0].split('.txt')[0];
var param = request.querystring
console.log('original ==> ' + rawurl)
// console.log('parameter ==> ' + param)
var uri ='';
Success-Guy /
Last active January 15, 2024 09:52
Auto-remove Node that is NotReady from Kubernetes cluster
# Get the list of nodes in the Kubernetes cluster
nodes=$(kubectl get node)
# Filter the nodes that are NotReady and not control-plane
notready=$(echo "$nodes" | awk '$2 == "NotReady" && $3!="control-plane" {print $1}')
# Check if there are any nodes that are NotReady and not control-plane
if [[ -n "$notready" ]]; then
# If there are, delete those nodes
Success-Guy /
Created April 29, 2022 22:42 — forked from bradtraversy/
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months)

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

Success-Guy /
Created August 14, 2021 11:26 — forked from CMCDragonkai/
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on