These are the snippets I use most of the time when administrating my ES cluster
To be updated
curl -XPUT 'http://escluster:9200/_cluster/settings' -d '{
"""Proof of concept of an adapter that will wrap a blocking IO library in | |
greenlets, so that it can be invoked by asyncio code and itself make calls out | |
to an asyncio database library. | |
hint: any Python ORM or database abstraction tool written against the DBAPI | |
could in theory allow asyncio round trips to a pure async DB driver like | |
asyncpg. | |
The approach here seems too simple to be true and I did not expect it to | |
collapse down to something this minimal, so it is very possible I am totally |
## Ever had to add something to your shell's config files (i.e. .bashrc) | |
## and open a new shell? Well, that may be fine, but you can achieve the | |
## same result, plus without having to open a new window/tab | |
## or execute a child process. | |
## | |
## Idea taken from https://learn.hashicorp.com/vault/getting-started/install | |
## lets check if any command `hello` exists | |
$ hello | |
bash: hello: command not found |
// Package ravenerrors adds support for github.com/pkg/errors's stacktrace to github.com/getsentry/raven-go. | |
// | |
// https://github.com/getsentry/raven-go/issues/88#issuecomment-269002948 | |
// | |
// It works as a replacement for github.com/getsentry/raven-go.CaptureError*. | |
// Stacktraces are extracted from the error if available and replace raven's default behavior. | |
package ravenerrors | |
import ( | |
"reflect" |
package main | |
import ( | |
"context" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" | |
"time" | |
) |
docker logs nginx 2>&1 | grep "127." | |
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container |
#!/bin/bash | |
# | |
# chkconfig: 35 95 05 | |
# description: Hello world application. | |
# Run at startup: sudo chkconfig hello-world on | |
# Load functions from library | |
. /etc/init.d/functions |
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
func main() { | |
r := genericMap([]int{1, 2, 3, 4}, func(x int) string { | |
return "Hello" |
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:
// array utils | |
// ================================================================================================= | |
const combine = (...arrays) => [].concat(...arrays); | |
const compact = arr => arr.filter(Boolean); | |
const contains = (() => Array.prototype.includes | |
? (arr, value) => arr.includes(value) | |
: (arr, value) => arr.some(el => el === value) |