My Elasticsearch cheatsheet with example usage via rest api (still a work-in-progress)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple groupcache example: https://github.com/golang/groupcache | |
// Running 3 instances: | |
// go run groupcache.go -addr=:8080 -pool=http://127.0.0.1:8080,http://127.0.0.1:8081,http://127.0.0.1:8082 | |
// go run groupcache.go -addr=:8081 -pool=http://127.0.0.1:8081,http://127.0.0.1:8080,http://127.0.0.1:8082 | |
// go run groupcache.go -addr=:8082 -pool=http://127.0.0.1:8082,http://127.0.0.1:8080,http://127.0.0.1:8081 | |
// Testing: | |
// curl localhost:8080/color?name=red | |
package main | |
import ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io" | |
"os" | |
"fmt" | |
"time" | |
) | |
type SlowWriter struct { |
A slightly updated version of this doc is here on my website.
I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by Alex, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting.
The first 1/2 of Go's concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. They start with a super small stack that can grow (and shrink) via dynamic allocation (and freeing). They are as simple as go f(x)
, where f()
is a function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
“window.zoomLevel”: 2, | |
“files.autoSave”: “onFocusChange”, | |
“editor.formatOnPaste”: true, | |
“editor.formatOnType”: true, | |
“editor.detectIndentation”: false, | |
“editor.minimap.enabled”: false, | |
“editor.fontLigatures”: true, | |
“editor.renderIndentGuides”: true, | |
“editor.renderWhitespace”: “boundary”, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './index.css'; | |
import ReactLoading from 'react-loading' | |
const PanelLoading = () => ( | |
<div className="panel"> | |
<ReactLoading className="loading-widget" type="bars" color="white" delay={0}/> | |
</div> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
yum update -y | |
yum install httpd24 -y | |
service httpd start | |
chkconfig httpd on | |
echo "<html><body><h1>Hello Cloud Gurus, this is X</h1></body></html>" > /var/www/html/index.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host_run/dbus/system_bus_socket npm start | |
while true | |
do | |
echo "App exited but container is still running to allow web terminal access" | |
sleep 3600 | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise, app, async, bodyParser, closeHotspot, config, connectOrStartServer, connectionFile, connectionsFromFile, connman, dnsServer, execAsync, express, fs, getIptablesRules, hostapd, ignore, iptables, manageConnection, openHotspot, os, passphrase, port, retryAsync, saveToFile, server, setupHostapd, setupUdhcpd, spawn, ssid, ssidList, startServer, systemd, udhcpd; | |
Promise = require('bluebird'); | |
connman = Promise.promisifyAll(require('connman-simplified-resin')()); | |
express = require('express'); | |
app = express(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM resin/raspberrypi3-debian:jessie | |
ENV INITSYSTEM on | |
# Add the key for foundation repository | |
RUN apt-get update | |
RUN apt-get install -y wget | |
RUN wget http://archive.raspberrypi.org/debian/raspberrypi.gpg.key -O - | sudo apt-key add - | |
# Add apt source of the foundation repository |
NewerOlder