If you're trying to do this, you came to the right place!
See this code in action here: https://twitter.com/CodingDoug/status/953031540811825152
- Create a Firebase project at the Firebase Console
#!/usr/bin/env python3 | |
""" | |
Copyright 2018, OpenCensus Authors | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
u may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |
/** | |
* Copyright (c) 2018, Tiernan Cridland | |
* | |
* Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby | |
* granted, provided that the above copyright notice and this permission notice appear in all copies. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL | |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | |
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER | |
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
#! /bin/bash | |
# [get_golang.sh](https://gist.github.com/n8henrie/1043443463a4a511acf98aaa4f8f0f69) | |
# Download latest Golang release for AMD64 | |
# https://dl.google.com/go/go1.10.linux-amd64.tar.gz | |
set -euf -o pipefail | |
# Install pre-reqs | |
sudo apt-get install python3 git -y | |
o=$(python3 -c $'import os\nprint(os.get_blocking(0))\nos.set_blocking(0, True)') |
const o = { | |
value: new Map, | |
done: false, | |
async * gen(...props) { | |
while (!this.done) { | |
if (this.value.size && !this.done) { | |
try { | |
for (const [key, val] of this.value) { | |
// yield* [{key, value: await Promise.all([].concat(val).map(prop => typeof prop === "function" ? prop() : prop)).then(values => { this.value.delete(key); return values }).catch(err => {console.log(err); return {error:[key, err]}})}]; | |
// does not interrupt immediately when `this.done` is set to `true` |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
// http://creativecommons.org/publicdomain/zero/1.0/ | |
// HTML files: try the network first, then the cache. | |
// Other files: try the cache first, then the network. | |
// Both: cache a fresh version if possible. | |
// (beware: the cache will grow and grow; there's no cleanup) | |
const cacheName = 'files'; |
If you're trying to do this, you came to the right place!
See this code in action here: https://twitter.com/CodingDoug/status/953031540811825152
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" |
let cache = new Map(); | |
let pending = new Map(); | |
function fetchTextSync(url) { | |
if (cache.has(url)) { | |
return cache.get(url); | |
} | |
if (pending.has(url)) { | |
throw pending.get(url); | |
} |
function kcc () { | |
usage () { | |
echo -en "Usage: $0 <context> <namespace>\n" | |
} | |
result () { | |
echo -en "-> Context: \e[96m$context\e[0m\n-> Namespace: \e[92m$namespace\n\e[0m" | |
} | |
if [ $# -eq 0 ] ; then | |
## If no options, print the current context/cluster and namespace | |
context="$(kubectl config current-context 2>/dev/null)" |