Skip to content

Instantly share code, notes, and snippets.

@TuvianNavy
TuvianNavy / public-bionic-wsl1-teraterm
Created May 2, 2021 09:22
public-bionic-wsl1-teraterm
ubuntu@WIN10:~$ sudo ssh-keygen -t rsa -b 4096 -P "" -f /etc/ssh/ssh_host_rsa_key
ubuntu@WIN10:~$ sudo ssh-keygen -t ecdsa -b 521 -P "" -f /etc/ssh/ssh_host_ecdsa_key
ubuntu@WIN10:~$ sudo ssh-keygen -t ed25519 -P "" -f /etc/ssh/ssh_host_ed25519_key
ubuntu@WIN10:~$ sudo service ssh start
[sudo] password for ubuntu:
(Windows firewall dialog appears. Permit it.)
* Starting OpenBSD Secure Shell server sshd [ OK ]
ubuntu@WIN10:~$ ssh-keygen -t ed25519 -P ""
ubuntu@WIN10:~$ cat .ssh/id_ed25519.pub >> .ssh/authorized_keys
@TuvianNavy
TuvianNavy / public-aws-sns
Created May 2, 2021 09:04
public-aws-sns
$ aws sns create-topic --name my-topic
$ aws sns list-topics
$ aws sns subscribe --topic-arn arn:aws:sns:us-west-2:xxxxxxxxxxxx:my-topic --protocol sms --notification-endpoint +8190xxxxxxxx
$ aws sns list-subscriptions
$ aws sns publish --topic-arn arn:aws:sns:us-west-2:xxxxxxxxxxxx:my-topic --message distinguishable-test-message
@TuvianNavy
TuvianNavy / reverse-inside-out-yaml.txt
Created September 11, 2020 22:04
reverse-inside-out transformation for YAML/JSON
ubuntu@livazplus:~$ curl https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/alternative.yaml | yq -c 'paths(scalars) as $p | [$p, getpath($p)] | flatten | reverse'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7113 100 7113 0 0 157k 0 --:--:-- --:--:-- --:--:-- 157k
["v1","apiVersion"]
["Namespace","kind"]
["kubernetes-dashboard","name","metadata"]
["v1","apiVersion"]
["ServiceAccount","kind"]
["kubernetes-dashboard","k8s-app","labels","metadata"]
@TuvianNavy
TuvianNavy / gist:4486149cbd4dbf3f6fc35c3d7b89face
Last active September 11, 2020 12:59
how to 'revert inside out' for YAML/JSON (just not exactly)
ubuntu@livazplus:~$ # see https://github.com/stedolan/jq/issues/78#issuecomment-348818517
ubuntu@livazplus:~$ curl https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/alternative.yaml | yq -c 'paths(scalars) as $p | [$p, getpath($p)]'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7113 100 7113 0 0 15530 0 --:--:-- --:--:-- --:--:-- 15496
[["apiVersion"],"v1"]
[["kind"],"Namespace"]
[["metadata","name"],"kubernetes-dashboard"]
[["apiVersion"],"v1"]
[["kind"],"ServiceAccount"]
@TuvianNavy
TuvianNavy / gist:533115378ea039984ed029dcaf2549e3
Last active August 20, 2020 16:24
dumping hii database a first step (GUIDs appear still broken)
allocated 4K blocks larger than 1127514 bytes
HiiDatabaseSize - 1127514
HiiPackageListHeader->PackageListGuid - 88096000
HiiPackageListHeader->PackageLength - 3213
HiiPackageHeader->Type - 0x02 (EFI_HII_PACKAGE_FORMS)
HiiPackageHeader->Length - 299
HiiPackageHeader->Type - 0x04 (EFI_HII_PACKAGE_STRINGS)
HiiPackageHeader->Length - 1132
HiiPackageHeader->Type - 0x04 (EFI_HII_PACKAGE_STRINGS)
HiiPackageHeader->Length - 517
@TuvianNavy
TuvianNavy / uefi-drivers.txt
Last active March 2, 2022 06:38
LivaZPlus-UEFI
T D
D Y C I
R P F A
V VERSION E G G #D #C DRIVER NAME IMAGE NAME
== ======== = = = == == =================================== ===================
54 00000011 D - - 1 - AMI USB Driver Uhcd
56 00000011 B - - 1 10 USB bus Uhcd
57 00000002 D - - 2 - USB Hid driver Uhcd
58 00000001 D - - 1 - USB Mass Storage driver Uhcd
6F 00000001 B - - 1 1 AMI AHCI BUS Driver Ahci
ubuntu@livazplus:~/Desktop/edk2/AppPkg/Applications/Duktape/src$ vi duk_config.h
ubuntu@livazplus:~/Desktop/edk2/AppPkg/Applications/Duktape/src$ rm -rf ../../../../Build/AppPkg/DEBUG_GCC5/X64/AppPkg/Applications/Duktape/ ; build -p AppPkg/AppPkg.dsc -m AppPkg/Applications/Duktape/Duktape.inf
Build environment: Linux-5.3.0-62-generic-x86_64-with-Ubuntu-18.04-bionic
Build start time: 01:21:39, Aug.05 2020
WORKSPACE = /home/ubuntu/Desktop/edk2
EDK_TOOLS_PATH = /home/ubuntu/Desktop/edk2/BaseTools
CONF_PATH = /home/ubuntu/Desktop/edk2/Conf
PYTHON_COMMAND = /usr/bin/python3.6
ubuntu@livazplus:~/Desktop/parse-json-benchmark$ lscpu --json | /home/ubuntu/go/bin/gojq -c .lscpu[12]
{"data":"Intel(R) Core(TM) i3-7100U CPU @ 2.40GHz","field":"Model name:"}
ubuntu@livazplus:~/Desktop/parse-json-benchmark$ free -h
total used free shared buff/cache available
Mem: 31G 648M 25G 526M 5.3G 29G
Swap: 2.0G 1.2M 2.0G
ubuntu@livazplus:~/Desktop/parse-json-benchmark$ yq --version
yq 2.10.1
ubuntu@livazplus:~/Desktop/parse-json-benchmark$ gojq -v
gojq 0.11.0 (rev: HEAD/go1.14.4)
ubuntu@livazplus:~/Desktop/parse-json-benchmark$ /home/ubuntu/go/bin/gojq -v
gojq 0.11.0 (rev: HEAD/go1.14.4)
ubuntu@livazplus:~/Desktop/parse-json-benchmark$ /home/ubuntu/go/bin/gojq --yaml-input . /etc/netplan/01-network-manager-all.yaml
{
"network": {
"ethernets": {
"enp2s0": {
"addresses": [
"192.168.179.99/24"
],
@TuvianNavy
TuvianNavy / xlsx-sample
Last active May 30, 2020 04:01
JavaScript XLSX (requires SheetJS)
var min_col = 1; // 0-indexed colnum (it means "B")
var min_row = 11; // 0-indexed rownum (it means "12")
var max_col; // 0-indexed colnum
var max_row; // 0-indexed rownum
XLSX = require('xlsx');
Book = XLSX.readFile(Sample_XLSX_Path);
Sheet1 = Book.Sheets[Sample_Sheet];
var range = XLSX.utils.decode_range(Sheet1['!ref']);
max_col = range.e.c;