Skip to content

Instantly share code, notes, and snippets.

@emmanuelnk
emmanuelnk / init_script
Last active March 27, 2023 09:26
Install Redis Server on Amazon Linux AMI EC2
#!/bin/sh
# From - http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
@emmanuelnk
emmanuelnk / albLogFormat.interface.ts
Created February 23, 2023 15:20
AWS Application Load Balancer Access Logs Typescript Interface
export interface AlbAccessLogFormat {
/**
* The type of request or connection. The possible values are as follows (ignore any other values):
*
* * http — HTTP
* * https — HTTP over TLS
* * h2 — HTTP/2 over TLS
* * grpcs— gRPC over TLS
* * ws — WebSockets
* * wss — WebSockets over TLS
@emmanuelnk
emmanuelnk / dwr.sh
Created November 18, 2021 16:58
Delete Workflow Runs
#!/usr/bin/env bash
# Delete workflow runs - dwr
# Given an "owner/repo" name, such as "qmacro/thinking-aloud",
# retrieve the workflow runs for that repo and present them in a
# list. Selected runs will be deleted. Uses the GitHub API.
# Requires gh (GitHub CLI), jq (JSON processor) and fzf
@emmanuelnk
emmanuelnk / log_bash_commands.bash
Last active September 16, 2022 22:10
Log bash commands
function log_cmd()
{
"$@"
ret=$?
if [[ $ret -eq 0 ]]
then
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") user[ $USER ] status[ Success ] code[ $ret ] cmd[ $@ ]" >> bash_command.log
else
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") user[ $USER ] status[ Error ] code[ $ret ] cmd[ $@ ]" >> bash_command.log
@emmanuelnk
emmanuelnk / .zshenv
Last active September 13, 2022 16:10
Aliases for jira-cli with Jira Cloud and ZSH
export JIRA_API_TOKEN=XXXXXXXXXXXXXXXXXXX
@emmanuelnk
emmanuelnk / CompareSheetsModifiedColumns.js
Last active September 4, 2022 16:10
CompareSheetsModifiedColumns
/**
* HOW TO USE
*
* 1. From your spreadsheet, go to Extensions > Apps Script
* 2. Paste the following function and click Run
* 3. You may be asked to give Apps Script permission to your sheet (Accept)
*
* IMPORTANT
*
* The first sheet MUST be the old sheet
@emmanuelnk
emmanuelnk / tree_style_tab_firefox.md
Created August 29, 2022 14:28 — forked from ruanbekker/tree_style_tab_firefox.md
Hide Native Tabs with Tree Style Tabs for Firefox
@emmanuelnk
emmanuelnk / merge.squash.rebase.md
Created August 25, 2022 16:46
git merge vs git merge --squash vs git rebase

Let's start by the following example:

[![enter image description here][1]][1]

Now we have 3 options to merge changes of feature branch into master branch:

  1. Merge commits
    Will keep all commits history of the feature branch and move them into the master branch
    Will add extra dummy commit.
@emmanuelnk
emmanuelnk / script.bash
Last active July 1, 2022 11:29
Installing vscode transparency/blur ubuntu 18.04
# [UPDATE]
# Its no longer complicated! Yay!
# Install Glassit Linux VSCode Extension
# then install this:
sudo apt install -y wmctrl x11-utils bash
# then restart VSCode. Done!
@emmanuelnk
emmanuelnk / koa-context.ts
Last active June 7, 2022 16:32
Simple Koa Context for testing in Typescript (Mocha-chai, Jest) etc
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-nocheck
// Ripped from https://github.com/koajs/koa/blob/master/test/helpers/context.js
// Solution courtesy of user @fl0w. See: https://github.com/koajs/koa/issues/999#issuecomment-309270599
// I've disabled type checking in this file but you are free to add types if you wish
// if you want more comprehensive Koa Context object to test stuff like Cookies etc
// then use https://www.npmjs.com/package/@shopify/jest-koa-mocks (requires Jest)