Skip to content

Instantly share code, notes, and snippets.

View marcelaraujo's full-sized avatar

Marcel Araujo marcelaraujo

View GitHub Profile
@marcelaraujo
marcelaraujo / create.sh
Created March 17, 2020 17:35
Create custom kubeconfig file for each user
#!/bin/bash
if [[ -z "$1" ]] ;then
echo "usage: $0 <username>"
exit 1
fi
user=$1
kubectl create sa ${user}
secret=$(kubectl get sa ${user} -o json | jq -r .secrets[].name)
@marcelaraujo
marcelaraujo / create.sh
Last active March 17, 2020 17:35
Get the Service Account and Token. Generate the Kubeconfig
Get the Service Account and Token. Generate the Kubeconfig
# Update these to match your environment
SERVICE_ACCOUNT_NAME=spinnaker-service-account
CONTEXT=$(kubectl config current-context)
NAMESPACE=spinnaker
NEW_CONTEXT=spinnaker
KUBECONFIG_FILE="kubeconfig-sa"
const TwitterPackage = require("twitter");
const DEBUG = process.env.debug;
const secret = {
consumer_key: process.env.consumer_key,
consumer_secret: process.env.consumer_secret,
access_token_key: process.env.access_token_key,
access_token_secret: process.env.access_token_secret
};
There are multiple flattening strategies for observables:
With mergeMap (which has flatMap as an alias), received observables are subscribed to concurrently and their emitted values are flattened into the output stream.
With concatMap, received observables are queued and are subscribed to one after the other, as each completes. (concatMap is mergeMap with a concurrency of one.)
With switchMap, when an observable is received it's subscribed to and any subscription to a previously received observable is unsubscribed.
With exhaustMap, when an observable is received it's subscribed to unless there is a subscription to a previously received observable and that observable has not yet completed - in which case the received observable is ignored.
The concatAll, exhaust, mergeAll and switchAll operators for higher-order observables are implemented using the *Map operators.
---------------------------------------------------------------------------------------------------------------------
@marcelaraujo
marcelaraujo / App.js
Created November 13, 2018 13:22
REACT & REDUX & ROUTER & HMR
// src/App.js
import React from 'react';
import {Provider} from 'react-redux';
import {ConnectedRouter} from 'react-router-redux';
import {history} from './history';
import {store} from './redux/store';
import {Root} from './components/Root';
@marcelaraujo
marcelaraujo / Redux-saga module example.md
Created November 13, 2018 13:22 — forked from sbsrnt/Redux-saga module example.md
redux-saga module example

Gist contains example files for redux-saga user(GET) module. The structure of redux for included files in this gist:

redux
├── user                          # Module name
│   ├── __tests__                 # Directory for redux module tests
│   │   ├── actions.test.js       # Action tests
│   │   └── saga.test.js          # Saga tests
│   ├── actions.js                # Module actions (f/e.: fetchUserRequest, fetchUserSuccess)
│   ├── reducer.js                # Module reducer
@marcelaraujo
marcelaraujo / bash-cheatsheet.sh
Created January 23, 2018 15:35 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@marcelaraujo
marcelaraujo / CHANGELOG.md
Created October 11, 2017 20:32 — forked from dispix/CHANGELOG.md
OAUTH2 Authentication and token management with redux-saga

Revision 5

  • Fix error parsing

Revision 4

  • Add missing yield in the login function

Revision 3

@marcelaraujo
marcelaraujo / web-servers.md
Created August 30, 2017 05:40 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000