(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/usr/bin/env bash | |
## Get the primary and secundary IPs | |
awk '/\|--/ && !/\.0$|\.255$/ {print $2}' /proc/net/fib_trie | |
## Get only the primary IPs | |
awk '/32 host/ { print i } {i=$2}' /proc/net/fib_trie |
# Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace | |
kubectl cp /tmp/foo_dir <some-pod>:/tmp/foo_dir | |
tar cf - /tmp/foo_dir | kubectl exec -i <some-pod> -- tar xf - | |
# Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container | |
kubectl cp /tmp/foo <some-pod>:/tmp/foo -c <specific-container> | |
tar cf - /tmp/foo | kubectl exec -i <some-pod> -c <specific-container> -- tar xf - | |
# Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace> | |
kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/foo |
#!/usr/bin/ruby | |
require "shellwords" | |
require "json" | |
if ARGV.length == 0 | |
extra_args = "" | |
elsif ARGV.length == 1 | |
extra_args = "-p #{ARGV[0]}" | |
else |
#!/usr/bin/env bash +x | |
## Do you need to test your exposed app but you don't have curl/wget/* installed? | |
## The ":" is a built-in command and it works similar to true. Let's say, ":" is more portable than "true" | |
## Simple and easy | |
:> /dev/tcp/localhost/22 | |
## Why using timeout? If any side has a firewall and it's dropping the packages, the request will take ~80 seconds to get the timeout. |
import { fromHex, utf16StrToUtf8Bytes } from "@unstoppablejs/utils"; | |
import { jsonEncrypt } from "@polkadot/util-crypto"; | |
import { createPair, Keyring } from "@polkadot/keyring"; | |
const keyToBytes = (input: string | Uint8Array): Uint8Array => | |
typeof input === "string" ? fromHex(input) : input; | |
export function createBackUpFileContent( | |
addresses: Array<{ | |
name: string; |
(Phaiax - 2019/12/1 - CC_BY_SA 4.0)
Lately I was porting a software from tokio/futures-1.0 to async-await.
I somehow thought async-std
was the successor of tokio
and ported everything to async-std
.
80% in, I noticed that my hyper
dependency requires tokio
and that it's not possible to replace tokio
with async-std
without also replacing hyper
. Also, tokio
and async-std
try to solve the same problem. So I started a journey into the inners of the rust async story to find out if it is possible to use both tokio
and async-std
at the same time. (tl;dr: it is). I had heard of reactors and executors before, but there was much new stuff to discover.
After publishing my article on ECMAScript 6, some have reached out to ask how I exactly I make it all work.
I refrained from including these details on the original post because they're subject to immiment obsoletion. These tools are changing and evolving quickly, and some of these instructions are likely to become outdated in the coming months or even weeks.
When evaluating the available transpilers, I decided to use 6to5, which has recently been renamed to Babel. I chose it based on:
// This script will boot app.js with the number of workers | |
// specified in WORKER_COUNT. | |
// | |
// The master will respond to SIGHUP, which will trigger | |
// restarting all the workers and reloading the app. | |
var cluster = require('cluster'); | |
var workerCount = process.env.WORKER_COUNT || 2; | |
// Defines what each worker needs to run |