Skip to content

Instantly share code, notes, and snippets.

View hackerzhut's full-sized avatar

Sara hackerzhut

View GitHub Profile
@hackerzhut
hackerzhut / Dockerfile
Created March 28, 2018 04:53 — forked from profjsb/Dockerfile
Refreshing Materialized Views in Postgres using Docker
# Dockerfile to run the cron jobs in root, including python/psycopg2
FROM alpine:edge
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing py-psycopg2
EXPOSE 6000
COPY refresh.py /refresh.py
COPY root /var/spool/cron/crontabs/root
CMD crond -l 2 -f
@hackerzhut
hackerzhut / color-log.js
Last active March 28, 2018 05:52
Color Log using Proxy
(() => {
const log = new Proxy({}, {
get: (_, color) => (...args) => console.log(`%c ${args.join(' ')}`, `color: ${color}`)
});
log.tomato('I am tomato')
log.chocolate('I am chocolate')
log.cornflowerblue('I am cornflowerblue')
log.darkcyan('I am darkcyan')
@hackerzhut
hackerzhut / config.json
Last active August 22, 2018 04:49
VSCode Config
{
"editor.fontFamily": "FiraCode-Light, OperatorMono-Light, Menlo, Monaco, monospace",
// Controls the font size in pixels.
"editor.fontSize": 15,
"workbench.colorTheme": "Atom One Dark",
"editor.lineHeight": 28,
// "window.zoomLevel": 0.25,
@hackerzhut
hackerzhut / es.js
Last active June 6, 2018 06:58
Unallocated shard error
{
"index" : "82656-2018-04-11-br-11-vic.avro",
"shard" : 1,
"primary" : false,
"current_state" : "unassigned",
"unassigned_info" : {
"reason" : "REPLICA_ADDED",
"at" : "2018-06-06T06:48:10.483Z",
"last_allocation_status" : "no_attempt"
},
@hackerzhut
hackerzhut / selections.go
Created August 7, 2018 00:48
Selections Permutation
package main
import (
"bytes"
"fmt"
"strconv"
)
func selectionHelper(runners string, chosen string) {
if runners == "" {
@hackerzhut
hackerzhut / client.go
Created November 28, 2018 03:26
Sample HTTP Go Client
package client
import (
"bytes"
"context"
"encoding/json"
"encoding/xml"
"fmt"
"github.com/telematicsct/gatekeeper/pkg/log"
"go.uber.org/zap"
@hackerzhut
hackerzhut / timer.go
Created December 26, 2018 07:28
Timer
func keepRunning(timeout int, action func(), cancel <-chan os.Signal) {
ticker := time.NewTicker(500 * time.Millisecond)
for {
select {
case <-cancel:
fmt.Printf("exiting. timed out\n")
ticker.Stop()
return
case <-ticker.C:
action()
@hackerzhut
hackerzhut / docker-compose.yaml
Created January 16, 2019 12:18
Jaeger docker compose
version: "3"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.3.1
networks:
- elastic-jaeger
ports:
- "127.0.0.1:9200:9200"
- "127.0.0.1:9300:9300"
@hackerzhut
hackerzhut / Optimize_read_path.md
Created February 28, 2019 04:09 — forked from MakMukhi/Optimize_read_path.md
gRPC-Go: Optimize read path

gRPC-Go: Optimize read path

Status: (Final)

Authors: mmukhi@google.com

Reviewers: dfawley@, menghanl@, yuxuanli@, psrini@

Last Updated: 2018-02-25

@hackerzhut
hackerzhut / k8s-svc-annotations.md
Created March 4, 2019 07:32 — forked from mgoodness/k8s-svc-annotations.md
AWS ELB-related annotations for Kubernetes Services (as of v1.12.0)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval (in minutes)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix
  • service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags (comma-separated list of key=value)
  • service.beta.kubernetes.io/aws-load-balancer-backend-protocol (http|https|ssl|tcp)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled (true|false)