Skip to content

Instantly share code, notes, and snippets.

Avatar

Emmanuel N Kyeyune emmanuelnk

View GitHub Profile
View log_bash_commands.bash
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 Sep 13, 2022
Aliases for jira-cli with Jira Cloud and ZSH
View .zshenv
export JIRA_API_TOKEN=XXXXXXXXXXXXXXXXXXX
@emmanuelnk
emmanuelnk / CompareSheetsModifiedColumns.js
Last active Sep 4, 2022
CompareSheetsModifiedColumns
View CompareSheetsModifiedColumns.js
/**
* 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 Aug 29, 2022 — forked from ruanbekker/tree_style_tab_firefox.md
Hide Native Tabs with Tree Style Tabs for Firefox
View tree_style_tab_firefox.md
@emmanuelnk
emmanuelnk / merge.squash.rebase.md
Created Aug 25, 2022
git merge vs git merge --squash vs git rebase
View merge.squash.rebase.md

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 / displayAwsAccountAlias.js
Last active Aug 19, 2022
GreaseMonkey script to show an AWS account alias in the top nav bar
View displayAwsAccountAlias.js
// ==UserScript==
// @name DisplayAWSAccountAlias
// @version 1
// @grant none
// @match https://*.console.aws.amazon.com/*
// ==/UserScript==
// Replace with your account numbers and desired alias
// The key is the account number and the value is the alias to display
const accountAliases = {
@emmanuelnk
emmanuelnk / aws-block-stack.ts
Created Jan 28, 2022 — forked from leegilmorecode/aws-block-stack.ts
Example of API Gateway caching on AWS using the CDK
View aws-block-stack.ts
// create the rest API for accessing our lambdas
const api: apigw.RestApi = new apigw.RestApi(this, "blogs-api", {
description: "blogs api gateway",
deploy: true,
deployOptions: {
// this enables caching on our api gateway, with a ttl of five minutes (unless overridden per method)
cachingEnabled: true,
cacheClusterEnabled: true,
cacheDataEncrypted: true,
stageName: "prod",
@emmanuelnk
emmanuelnk / dwr.sh
Created Nov 18, 2021
Delete Workflow Runs
View dwr.sh
#!/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 / code-reviews.md
Created Oct 8, 2021 — forked from sktse/code-reviews.md
How to Keep Pull Requests Manageable
View code-reviews.md

How to Keep Pull Requests Manageable

  • There are a lot different things you can try to keep pull requests manageable.
  • These pointers are not meant to be rules, but merely guidelines when possible. Due to the nature of what you are working on, some of these techniques may not be possible (or incredibly difficult).

More like guidelines

  • Either way, here are some tips to help make people not want to claw their eyes out reviewing a pull request.

The Basics

  • These are the fundamental basics to a pull request and ALL pull requests should have these, regardless of how small or meaningless it is.
@emmanuelnk
emmanuelnk / cronlist.sh
Created Mar 31, 2021 — forked from islander/cronlist.sh
Script to list all cron events on a system - found on stackoverflow.com: http://bit.ly/nkFwD9 Modified from original to list /etc/anacron jobs
View cronlist.sh
#!/bin/bash
# System-wide crontab file and cron job directory. Change these for your system.
CRONTAB='/etc/crontab'
ANACRONTAB='/etc/anacrontab'
CRONDIR='/etc/cron.d'
# Single tab character. Annoyingly necessary.
tab=$(echo -en "\t")