Skip to content

Instantly share code, notes, and snippets.

View rayjanoka's full-sized avatar

Ray rayjanoka

View GitHub Profile
@rayjanoka
rayjanoka / kubectl-logs-to-slack.sh
Last active June 2, 2023 21:30
tail/pipe kubectl logs to a slack channel with slackcat
#!/bin/sh
set -e
ARCH=amd64
KUBECTL_VERSION=1.27.2
TETRAGON_VERSION=0.9.0
SLACKCAT_VERSION=1.7.3
SLACK_CHANNEL=test
apk -q add curl grep sed coreutils
@rayjanoka
rayjanoka / kernel error
Created March 23, 2023 04:08
vitastor #2 - bmhv3
Mar 23 03:50:07 bmhv4 kernel: ------------[ cut here ]------------
Mar 23 03:50:07 bmhv4 kernel: NETDEV WATCHDOG: enp33s0f0 (ixgbe): transmit queue 21 timed out
Mar 23 03:50:07 bmhv4 kernel: WARNING: CPU: 17 PID: 0 at net/sched/sch_generic.c:529 dev_watchdog+0x21f/0x230
Mar 23 03:50:07 bmhv4 kernel: Modules linked in: vhost_net vhost vhost_iotlb tap nfnetlink_cttimeout nbd openvswitch nsh nf_conncount ib_core tls xt_TPROXY nf_tproxy_ipv6 nf_tproxy_ipv4 xt_CT cls_bpf algif_ha>
Mar 23 03:50:07 bmhv4 kernel: msr ramoops reed_solomon pstore_blk pstore_zone efi_pstore ip_tables x_tables autofs4 btrfs blake2b_generic raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor asyn>
Mar 23 03:50:07 bmhv4 kernel: CPU: 17 PID: 0 Comm: swapper/17 Not tainted 5.19.0-35-generic #36~22.04.1-Ubuntu
Mar 23 03:50:07 bmhv4 kernel: Hardware name: Supermicro Super Server/H11SSL-i, BIOS 2.0a 08/08/2019
Mar 23 03:50:07 bmhv4 kernel: RIP: 0010:dev_watchdog+0x21f/0x230
Mar 23 03:50:07 bmhv4 kernel: Code: 00 e9 31 ff ff ff 4c
@rayjanoka
rayjanoka / bmhv3 osd4
Created March 21, 2023 16:08
vitastor #1 OSDs
[OSD 4] avg latency for subop 15 (ping): 256 us
[OSD 4] avg latency for subop 15 (ping): 254 us
[OSD 4] avg latency for subop 15 (ping): 212 us
[OSD 4] avg latency for subop 15 (ping): 240 us
[OSD 4] avg latency for subop 15 (ping): 213 us
[OSD 4] avg latency for subop 15 (ping): 272 us
[OSD 4] avg latency for subop 15 (ping): 275 us
[OSD 4] avg latency for subop 15 (ping): 241 us
[OSD 4] avg latency for subop 15 (ping): 249 us
[OSD 4] avg latency for subop 15 (ping): 230 us
@rayjanoka
rayjanoka / bmhv3 journal (osd4)
Last active March 21, 2023 16:06
vitastor #1 journals
-- Logs begin at Tue 2023-03-21 12:40:24 UTC. --
Mar 21 15:42:41 bmhv3 node[467775]: Waiting to become master
Mar 21 15:42:46 bmhv3 node[467775]: Waiting to become master
Mar 21 15:42:51 bmhv3 node[467775]: Waiting to become master
Mar 21 15:42:56 bmhv3 node[467775]: Waiting to become master
Mar 21 15:43:01 bmhv3 node[467775]: Waiting to become master
Mar 21 15:43:06 bmhv3 node[467775]: Waiting to become master
Mar 21 15:43:11 bmhv3 node[467775]: Waiting to become master
Mar 21 15:43:12 bmhv3 etcd[465468]: Starting auto-compaction at revision 1022 (retention: 10 revisions)
Mar 21 15:43:12 bmhv3 etcd[465468]: Finished auto-compaction at revision 1022
@rayjanoka
rayjanoka / ionice-etcd-systemd.sh
Last active August 24, 2021 02:38
Script and systemd service to apply I/O highest priority and best effort scheduling class to the etcd process
cat <<'EOT' >/usr/local/bin/ionice-etcd.sh
#!/usr/bin/env bash
echo "Starting ionice etcd process watcher..."
while true; do
PID=$(pgrep etcd)
if [ "$PID" != "" ]; then
if [ "$(ionice -p $PID)" != "best-effort: prio 0" ]; then
echo "Setting I/O highest priority and best effort scheduling class for etcd PID: $PID"
ionice -c2 -n0 -p $PID
fi
@rayjanoka
rayjanoka / nats-jwt-nodejs-add-user.js
Last active August 17, 2021 18:42
Example code for the nats jwt in nodejs
const nkeys = require("nkeys.js");
const base32Encode = require('base32-encode');
const base64Url = require('base64url');
const shajs = require('sha.js');
const utf8 = require('utf8');
const path = require('path');
const fs = require("fs");
async function setupClaim(issuedAt, expiresAt, accountSigningKeyPub, jti, userPublicKey, accountId, pub, sub) {
return `{
@rayjanoka
rayjanoka / tailscale-enable-subnet-routes.sh
Last active January 11, 2022 10:25
Enable Tailscale Subnet Routes via API
#!/usr/bin/env sh
set -e
if [ "$TAILSCALE_APIKEY" = "" ]; then
echo "Missing TAILSCALE_APIKEY environment variable, exiting"; exit 21
fi
NAME="$(hostname -f)"
TAILSCALE_API="https://api.tailscale.com/api/v2"

Keybase proof

I hereby claim:

  • I am rayjanoka on github.
  • I am rayar (https://keybase.io/rayar) on keybase.
  • I have a public key ASDFt8YEZJ1q1QpmDpLPb2fcIynjj0tYV_5gymff7RUQsQo

To claim this, I am signing this object:

@rayjanoka
rayjanoka / example.js
Last active July 19, 2018 04:30 — forked from rayh/example.js
Spawn binary from AWS Lambda
const spawn = require('./node_modules/child-process-promise/lib').spawn;
process.env["PATH"] = process.env["PATH"] + ":" +
process.env["LAMBDA_TASK_ROOT"];
function spawnCmd(cmd, args, opts) {
var opts = opts||{};
console.log("[spawn]", cmd, args.join(' '), opts);
let cmd_promise = spawn(cmd, args, opts);