Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

type CacheMetadata = { | |
createdTime: number | |
maxAge: number | null | |
expires: number | null | |
} | |
function shouldRefresh(metadata: CacheMetadata) { | |
if (metadata.maxAge) { | |
return Date.now() > metadata.createdTime + metadata.maxAge | |
} |
package main | |
import ( | |
"bytes" | |
"io/ioutil" | |
"log" | |
"os" | |
"os/exec" | |
) |
#!/bin/bash | |
IMAGE="gcr.io/google-containers/ubuntu-slim:0.14" | |
COMMAND="/bin/bash" | |
SUFFIX=$(date +%s | shasum | base64 | fold -w 10 | head -1 | tr '[:upper:]' '[:lower:]') | |
usage_exit() { | |
echo "Usage: $0 [-c command] [-i image] PVC ..." 1>&2 | |
exit 1 | |
} |
// | |
// Quick & Dirty Google Cloud Storage emulator for tests. Requires | |
// `stream-buffers` from npm. Use it like this: | |
// | |
// `new MockStorage().bucket('my-bucket').file('my_file').createWriteStream()` | |
// | |
class MockStorage { | |
buckets: {[name: string]: MockBucket}; |
package enum_example | |
import ( | |
"bytes" | |
"encoding/json" | |
) | |
// TaskState represents the state of task, moving through Created, Running then Finished or Errorred | |
type TaskState int |
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) === | |
# | |
# by Fotis Evangelou, developer of Engintron (engintron.com) | |
# | |
# ~ Updated September 2024 ~ | |
# | |
# | |
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores. | |
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage. | |
# |
rx.Observable.prototype.safeSubscribe = function(scope, fn, err, cmp) { | |
var disposable = this.safeApply(scope, fn).subscribe(angular.noop, err, cmp); | |
scope.$on("$destroy", function() { | |
disposable.dispose(); | |
}); | |
return disposable; | |
}; |
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.
$ python -m SimpleHTTPServer 8000
$scope.safeApply = function(fn) { | |
var phase = this.$root.$$phase; | |
if(phase == '$apply' || phase == '$digest') | |
this.$eval(fn); | |
else | |
this.$apply(fn); | |
}; | |
// OR |