(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.
| // keepDoingSomething will keep trying to doSomething() until either | |
| // we get a result from doSomething() or the timeout expires | |
| func keepDoingSomething() (bool, error) { | |
| timeout := time.After(5 * time.Second) | |
| tick := time.Tick(500 * time.Millisecond) | |
| // Keep trying until we're timed out or got a result or got an error | |
| for { | |
| select { | |
| // Got a timeout! fail with a timeout error | |
| case <-timeout: |
(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.
| import io | |
| import pymongo | |
| import psycopg2 | |
| import gridfs | |
| import timeit | |
| # For fairness use the same chunk size - 512k. | |
| CHUNK_SIZE = 1024 * 512 | |
| def bench_mongo(fs, size): |
| /* | |
| Copyright (C) 2021 Pascal de Vink (Tweakers.net) | |
| This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Lesser General Public | |
| License as published by the Free Software Foundation; either | |
| version 2.1 of the License, or (at your option) any later version. | |
| This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
As configured in my dotfiles.
start new:
tmux
start new with session name: