Source: https://carlos.mendible.com/2018/03/18/my-kubectl-cheat-sheet/
kubectl apply -f [yaml definition file]
kubectl get deployment [deployment name] -o yaml
Source: https://carlos.mendible.com/2018/03/18/my-kubectl-cheat-sheet/
kubectl apply -f [yaml definition file]
kubectl get deployment [deployment name] -o yaml
var bsearch = function(f, a, b, z) { | |
if (a + 1 === b) { | |
return a; | |
} | |
var m = Math.floor(( a + b ) / 2); | |
if (f(m) <= z) { | |
return bsearch(f, m, b, z); | |
} else { | |
return bsearch(f, a, m, z); | |
} |
// [a] -> [[a]] -> [[a]] | |
var iter = function(arr, parents) { | |
if (R.isEmpty(arr)) { | |
return parents; | |
} | |
return R.addIndex(R.chain)(function(a, index) { | |
return iter( | |
R.remove(index, 1, arr), | |
R.map(R.append(a), parents)); |
time seq 10 | xargs -Iz echo "hello" |
module Main where | |
import Prelude (Unit, negate, (==), (>>>), (-), (>), (+), ($), bind) | |
import Data.Foldable (traverse_, foldl) | |
import Data.String (toCharArray) | |
import Control.Monad.State (State, execState, modify) | |
import Control.Monad.Eff (Eff) | |
import Control.Monad.Eff.Console (CONSOLE, logShow) | |
match :: Int -> Char -> Int |
// I've been writing validation utilities for many times, | |
// never satisfied until I realize that the combination of `liftp` and `toPromise` | |
// is just perfect. | |
// It could work with any number of arguments. Leaving | |
// the choices to you of what error to return and how to check if an argument is valid. | |
var P = require('bluebird-promisell'); | |
var R = require('ramda'); | |
// Number -> Number -> Promise Number |
module Main where | |
import Prelude | |
import Control.Monad.Aff | |
import Control.Parallel (sequential, parallel) | |
import Control.Monad.Eff.Class (liftEff) | |
import Control.Monad.Eff (Eff) | |
import Control.Monad.Eff.Console (CONSOLE, log) | |
type A = String |
var P = require('bluebird-promisell'); | |
var R = require('ramda'); | |
var S = require('./service'); | |
// S.getTweets :: UserId -> Promise [Tweet] | |
// S.getUserName :: UserId -> Promise String | |
// S.getUserPhoto :: UserId -> Promise String | |
// makeUser :: (UserId, String, String) -> User | |
var makeUser = function(id, name, photo) { |
var P = require('bluebird-promisell'); | |
var S = require('sanctuary').create({ checkTypes: true, env: require('sanctury').env }); | |
// toPromiseMaybe :: Maybe Promise a -> Promise Maybe a | |
var toPromiseMaybe = S.maybe(P.purep(S.Nothing()), P.liftp1(S.Just)); |
var promiseShouldFail = function(promise) { | |
return new Promise(function(resolve, reject) { | |
promise.then(reject).catch(resolve); | |
}); | |
}; | |
describe('This rejected promise', function() { | |
it('should fail', function() { | |
return promiseShouldFail(Promise.reject(10)); | |
}); |