Skip to content

Instantly share code, notes, and snippets.

View brayoh's full-sized avatar
🎯
Focusing

Brian Njenga brayoh

🎯
Focusing
View GitHub Profile
  1. Open terminal.
  2. Use any one of following to install youtube-dl (A downloader written in python).
    • Fire these 2 command if you have curl installed.
    sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl 
    sudo chmod a+rx /usr/local/bin/youtube-dl
    
    • Fire these 2 commands

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl

@brayoh
brayoh / cognito.yml
Created January 13, 2022 16:58 — forked from chris/cognito.yml
Cognito user pool setup for Serverless (as CloudFormation resource)
#
# Cognito user pool/auth setup
#
Resources:
MyAppUserPool:
Type: AWS::Cognito::UserPool
Properties:
UserPoolName: myapp_user_pool
UsernameAttributes: # use email as username/login
- 'email'
@brayoh
brayoh / ThinkAboutMonads.md
Created January 10, 2020 05:46 — forked from cscalfani/ThinkAboutMonads.md
How to think about monads

How to think about Monads

Initially, Monads are the biggest, scariest thing about Functional Programming and especially Haskell. I've used monads for quite some time now, but I didn't have a very good model for what they really are. I read Philip Wadler's paper Monads for functional programming and I still didnt quite see the pattern.

It wasn't until I read the blog post You Could Have Invented Monads! (And Maybe You Already Have.) that I started to see things more clearly.

This is a distillation of those works and most likely an oversimplification in an attempt to make things easier to understand. Nuance can come later. What we need when first learning something is a simple, if inaccurate, model.

This document assumes a beginner's knowledge of pure functional programming and Haskell with some brief encounters of Monads, e.g. [Functors, Applicatives, And

@brayoh
brayoh / serverless.yml
Created October 21, 2019 08:51 — forked from codecitizen/serverless.yml
A serverless.yml file configuring a AWS ElastiCache redis instance that is accessible by all AWS Lambda functions deployed by this serverless function.
service: my-service
provider:
name: aws
runtime: nodejs8.10
stage: ${opt:stage, 'dev'}
environment:
REDIS_HOST:
"Fn::GetAtt": [ElasticCacheCluster, RedisEndpoint.Address]
functions:
# use to ctrl + a
set -g prefix C-a
set-option -g history-limit 100000
### COLOUR (Solarized 256)
#### COLOUR (Solarized 256)
# default statusbar colors
#set-option -g status-bg colour235 #base02
#set-option -g status-fg colour136 #yellow
@brayoh
brayoh / get_element_width_and_height.js
Created April 11, 2019 09:09
Get the width and height of an dom element in react
class GenericHeightAndWidth extends Component {
state = {
elementWidth: 0,
elementHeight: 0
};
componentDidMount() {
const elementWidth = document.getElementById('element_id').clientWidth; // get element width
const elementHeight = document.getElementById('element_id').clientWidth; // get element height

Keybase proof

I hereby claim:

  • I am brayoh on github.
  • I am brayoh (https://keybase.io/brayoh) on keybase.
  • I have a public key ASB_XARbgKJ9t6_MJzSe3yAAQMe-N0Md3fRQiyxHMpJhdQo

To claim this, I am signing this object:

@brayoh
brayoh / introrx.md
Created April 12, 2018 13:15 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@brayoh
brayoh / class-change.js
Created January 13, 2018 16:25
code snippet for changing an element class name(s)
addClass(el, clas, callback) {
if (el) {
const contains = el.classList.contains(clas);
if (contains) {
// dont add the class again
} else {
el.classList.add(clas);
}
@brayoh
brayoh / bump_version.sh
Created August 31, 2017 05:07
Script for semantic versioning and tagging your app releases in git
#!/bin/bash
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3"
# this script will display the current version, automatically
# suggest a "minor" version update, and ask for input to use
# the suggestion, or a newly entered value.