Skip to content

Instantly share code, notes, and snippets.

Emmanuel N Kyeyune emmanuelnk

View GitHub Profile
@emmanuelnk
emmanuelnk / lcd2LineDisplay.ino
Created May 12, 2016
lcd2LineDisplay Function
View lcd2LineDisplay.ino
void lcd2LineDisplay(String UpString, String DownString, int delaytime) {
//LiquidCrystal_I2C lcd(0x27, 16, 2); //Create a new LiquidCrystal_I2C object if one hasn't been globally created
//lcd.backlight(); //Turn on backlight everytime the function runs
lcd.clear();
delay(500);
lcd.setCursor(0, 0);
lcd.print(UpString);
lcd.setCursor(0, 1);
lcd.print(DownString);
@emmanuelnk
emmanuelnk / GitHub-Forking.md
Created Nov 9, 2017 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow
View GitHub-Forking.md

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

View github-cheat-sheet.md

Useful Git commands

This is just stuff that I have put down that I find I use a lot of the time for my own reference.

Latest changes from repo to your machine

$ git pull
@emmanuelnk
emmanuelnk / pygrib_eccodes_python3.6_install.md
Last active Apr 20, 2020
How to install PyGrib with ECCodes (Python 3.6.5, Ubuntu 18, 16, RHEL)
View pygrib_eccodes_python3.6_install.md

How to install PyGrib with ECCodes (Python 3.6.5, Ubuntu 19, 18, 16, RHEL, Lambda, Linux AMI, Docker)

[ last_updated: 07-JAN-2020 ]

Recently I've had to work with Meterological data of the GRIB format. Needless to say, if you're reading this, you probably know how hard it is to get a library that can read them and even harder, setting up those libraries. Pygrib for python is by far the best library for reading grib files but the installation can leave you dizzy

In this tutorial I use Ubuntu 18 and python 3.6.5 virtualenv. Note: You don't have to use virtualenv Python. You can just as well use your system Python 3 however I personally find virtualenv a clean way to deal with these kind of complicated setups (prevents me mucking up my system's Python). This setup should also work with lower and higher Ubuntu versions (as someone below mentioned) and other Linux distros (like RHEL - AWS Linux AMI etc). The key to this installation is to build eccodes correctly (for your machine architecture) and succe

@emmanuelnk
emmanuelnk / download_file_from_ftp_progress_bar.py
Created Aug 30, 2018
Download file from FTP Server, upload file to S3 with Progress Bar in Python
View download_file_from_ftp_progress_bar.py
import progressbar
from hurry.filesize import size
filesize = ftp.size(file)
try:
down_progress = progressbar.AnimatedProgressBar(end=filesize, width=50)
with open(TEMP_DIR + file, 'wb') as f:
def download_progress(chunk):
f.write(chunk)
down_progress + len(chunk)
View start_new_node_project_easily.bash
# first install npx (https://github.com/zkat/npx)
npm install -g npx
# set your npm defaults if you havent already
npm set init.author.name "Your name"
npm set init.author.email "your@email.com"
npm set init.author.url "https://your-url.com"
npm set init.license "MIT"
@emmanuelnk
emmanuelnk / fizzbuzz_in_ES6.js
Last active Aug 1, 2019
FizzBuzz but with ES6!
View fizzbuzz_in_ES6.js
const fizzbuzz = (min, max) => new Array(max-min+1)
.fill(0)
.map((f,i) => console.log(`${((i+1)%3 === 0) ? 'fizz' : ''}${((i+1)%5 === 0) ? 'buzz' : ''}` || i+1))
fizzbuzz(1, 100)
@emmanuelnk
emmanuelnk / safePromiseAllHandler.js
Last active Feb 13, 2019
Handling the fast-fail behavior of Promise.all when using async/await
View safePromiseAllHandler.js
// TL,DR :
// here is a wrapper for PromiseAll that handles rejection and avoids fast fail behavior
const softPromiseAll = arr => {
return Promise.all(arr.map(
promise => new Promise(
resolve => promise.then(resolve).catch(resolve)
)
)).then(results => results)
}
@emmanuelnk
emmanuelnk / DynamoDBClient.py
Created Feb 27, 2019
Simple client wrapper library for Dynamodb access in Python (boto3)
View DynamoDBClient.py
# based off the excellent gist by Martina Pugliese
# https://gist.github.com/martinapugliese/cae86eb68f5aab59e87332725935fd5f
import boto3
from boto3.dynamodb.conditions import Key, Attr
from boto3.dynamodb.types import DYNAMODB_CONTEXT
dynamodb = boto3.resource("dynamodb")
@emmanuelnk
emmanuelnk / terraform_install_64bit_linux.bash
Created Apr 10, 2019
Install Terraform on 64 bit Linux
View terraform_install_64bit_linux.bash
# 0.XX.XX is the terraform version you need
wget https://releases.hashicorp.com/terraform/0.XX.XX/terraform_0.XX.XX_linux_amd64.zip -P ~/Downloads/terraform/
cd ~/Downloads/terraform && unzip terraform_0.11.8_linux_amd64.zip && cd terraform
sudo mv terraform /usr/local/bin/
nano ~/.bashrc
export PATH="$PATH:/usr/local/bin/terraform"
source ~/.bashrc
# then from anywhere
You can’t perform that action at this time.