Skip to content

Instantly share code, notes, and snippets.

View Neurostep's full-sized avatar

Maksim Terekhin Neurostep

  • Amsterdam, Netherlands
View GitHub Profile
@Neurostep
Neurostep / index.js
Created November 24, 2015 09:41
requirebin sketch
var Rx = require("rx");
var o = Rx.Observable.interval(100)
.take(10)
.map(function(x) { if (x % 3 === 1) { throw x; } else { return x; } })
.retry(2)
.subscribe(function(a) { console.log("BBB", a); });
@Neurostep
Neurostep / index.js
Last active November 29, 2015 11:22
requirebin sketch
const bufferSize = 2
const startEvery = 1 // also tried -1, 0, 1, 3
Rx.Observable.of(1,2,3,4,5)
.bufferCount(bufferSize, startEvery)
.filter(function(x) { return x.length > 1; })
.subscribe(console.log.bind(console));
@Neurostep
Neurostep / test-flatten.js
Created August 1, 2016 13:46
Test gist for CitrusByte
/*
* Function flattens the nested array of Ints
*
* @param {Array} array
* Array (possibly nested) of Ints
*
* @return {Array}
* Return's flatten Arrays of Ints
*
* testFlatten :: Array(Array Int) -> Array Int
@Neurostep
Neurostep / postgres-cheatsheet.md
Created April 8, 2020 13:27 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
## Useful Commands
Get kubectl version
kubectl version
Get cluster info:
@Neurostep
Neurostep / find-k8snode-interface.sh
Created May 29, 2020 14:25 — forked from r0mdau/find-k8snode-interface.sh
How to get tcpdump for containers inside Kubernetes pods
# find the kube node of the running pod, appear next to hostIP, and note containerID hash
kubectl get pod mypod -o json
# -> save hostIP
# -> save containerID
# connect to the node and find the pods unique network interface index inside it's container
docker exec containerID /bin/bash -c 'cat /sys/class/net/eth0/iflink'
# -> returns index
# locate the interface of the node
@Neurostep
Neurostep / k8s-update-secret.md
Created July 1, 2020 12:27 — forked from dleske/k8s-update-secret.md
k8s: Updating a Secret

Hopefully helped another k8s newbie with the following. The question was, how do you update a single key in a secret in k8s? I don't know anything about secrets but I will probably want to know this in the future, so here we go.

First, to create a dummy secret:

apiVersion: v1
kind: Secret
metadata:
  name: test-secret
data:
@Neurostep
Neurostep / tcpdump & ngrep
Created August 4, 2020 16:21 — forked from PellePedro/tcpdump & ngrep
tcpdump & ngrep
tcpdump advanced filters
========================
Sebastien Wains <sebastien -the at sign- wains -dot- be>
http://www.wains.be
$Id: tcpdump_advanced_filters.txt 36 2013-06-16 13:05:04Z sw $
Notes :