Skip to content

Instantly share code, notes, and snippets.

View NonLogicalDev's full-sized avatar

Oleg Utkin NonLogicalDev

View GitHub Profile
@NonLogicalDev
NonLogicalDev / vault-list-tokens.sh
Last active January 6, 2021 08:42
List all token accessors with creation dates and met information.
#!/bin/sh
vault list -format json /auth/token/accessors \
| jq -r '.[]' | xargs -I % vault token lookup -format=json -accessor % \
| jq -cr '.data|[(.creation_time | todate),.accessor,.display_name,(.meta|tojson)]|join("%%")' \
| column -t -xs %% | sort -h
package main
import (
"encoding/json"
"fmt"
"sort"
"strings"
"sync"
"time"
@NonLogicalDev
NonLogicalDev / machine.js
Created October 23, 2020 22:21
Generated by XState Viz: https://xstate.js.org/viz
const m = Machine({
key: 'agent-probe',
initial: 'connecting',
states: {
connecting: {
on: {
"GRPC_CONNECTED": 'connected',
"GRPC_DISCONNECTED": 'connecting',
"CTX_DONE": 'shutdown',
}

Linux driver Information on Ethernet Adapters I have come across

@NonLogicalDev
NonLogicalDev / machine.js
Last active October 7, 2020 00:46
Generated by XState Viz: https://xstate.js.org/viz
const m = Machine({
key: 'agent-probe',
initial: 'connecting',
states: {
connecting: {
on: {
"GRPC_CONNECTED": 'connected',
"GRPC_DISCONNECTED": 'connecting',
"CTX_DONE": 'shutdown',
}
@NonLogicalDev
NonLogicalDev / @ UniFi Convert and or Rename Switch Profile.md
Last active April 18, 2021 21:30
MongoDB Shell script to convert and rename a Custom Switch Profile to Network Switch Profile

SSH Into Cloud Key, or Machine with Cloud controller's Mongo Shell:

ssh admin@<cloudkey-ip> -t mongo localhost:27117

Then you can use the following snippet tailoring it to your needs:

version: "2"
services:
influxdb:
image: "influxdb"
restart: always
mem_limit: 750m
volumes:
- ./data/influxdb:/var/lib/influxdb
ports:
- 8086:8086
@NonLogicalDev
NonLogicalDev / git-snap.sh
Last active February 22, 2023 23:21
A very handy git helper utility to copy a snapshot of a WORKTREE from a given Commit (SHA) into a given DIR.
#!/bin/bash
PROG="$(basename $0)"
_help() {
if [[ -n $1 ]]; then
echo "ERROR: $1"
echo
fi
echo "INFO:"
echo " A utility for snapshotting a tree from a given commit."
package internal
import (
"context"
"sync"
"sync/atomic"
"time"
)
type CtxWG struct {
@NonLogicalDev
NonLogicalDev / @LanguageNotes.md
Last active December 6, 2017 23:15
Notes For Languages I Use:

Notes For Languages I Use: