Skip to content

Instantly share code, notes, and snippets.

View NonLogicalDev's full-sized avatar

Oleg Utkin NonLogicalDev

View GitHub Profile
@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:

@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',
}

Linux driver Information on Ethernet Adapters I have come across

@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',
}
package main
import (
"encoding/json"
"fmt"
"sort"
"strings"
"sync"
"time"
@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
@NonLogicalDev
NonLogicalDev / main.go
Created January 26, 2021 00:11
Go Cobra Environment Mapping Example
package main
import (
"context"
"fmt"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
@NonLogicalDev
NonLogicalDev / git-ls-index.py
Created November 16, 2021 01:51
A toy git index file parser in python
#!/usr/bin/env python3
from io import TextIOWrapper
from typing import List
import os
import sys
import math
import json
import datetime
@NonLogicalDev
NonLogicalDev / stg-repair-top.sh
Last active March 23, 2022 20:07
Stacked git helper script to repair topmost amended commit.
# A collection of improvised utilites to fixup stacked git metadata