Skip to content

Instantly share code, notes, and snippets.

@subuk
subuk / main.go
Created July 20, 2021 11:36
Matrix Spiral
package main
import "fmt"
var Matrix = [][]int{
{63, 22, 17, 39, 36},
{53, 22, 31, 40, 36},
{43, 81, 11, 41, 36},
{13, 22, 87, 42, 38},
{33, 22, 91, 47, 99},
@subuk
subuk / yandex_lockbox.py
Created May 18, 2021 19:56
Ansiblie lookup plugin for Yandex Cloud lockbox
# Usage: '{{ lookup("yandex_lockbox", "e6r3ox0h4q0", field="some_secret") }}'
import os
import os.path
import time
import json
import urllib.request
import jwt
from ansible.plugins.lookup import LookupBase
from ansible.errors import AnsibleError

https://zenhax.com/viewtopic.php?t=27

It starts with 0x78 (rarely also with 0x58).
Use offzip to test if it's really zlib.
Code:
78 da ed 8f 6b 48 53 61 1c c6 df 65 35 ed 32 8d   x...kHSa...e5.2.
4a 49 9d 65 20 88 93 2d 13 ba a0 53 ab 85 5a b9   JI.e ..-...S..Z.
96 49 a2 76 d0 32 d7 cd a8 b9 72 a9 1d 2d fd 60   .I.v.2....r..-.`
65 84 a5 cd 4a 26 eb 2a 76 d9 64 5e 32 87 a7 bc   e...J&.*v.d^2...
network_config: |
version: 2
ethernets:
eth0:
match:
macaddress: "52:54:00:52:54:00"
addresses:
- 10.0.0.10/255.255.255.0
gateway4: 10.0.0.1
nameservers:
@subuk
subuk / asg_deploy.go
Created December 24, 2018 15:14
ASG Automatic Deployment
func (e *ASGTarget) Deploy(ctx context.Context, artifact Artifact, output chan DeployLogEntry) error {
ctx, _ = context.WithTimeout(ctx, e.Timeout)
if artifact.Type != ARTIFACT_AMI {
return fmt.Errorf("unsupported artifact type '%s'", artifact.Type)
}
asg, err := e.fetchAsg()
if err != nil {
return err
}
oldLc, err := e.fetchLc(asg)
@subuk
subuk / asg-terminate-old-instances.go
Created May 29, 2018 09:11
Terminate aws asg instances with old launch configuration
package main
import (
"flag"
"fmt"
"os"
"time"
"github.com/aws/aws-sdk-go/aws"
aws_session "github.com/aws/aws-sdk-go/aws/session"
@subuk
subuk / expand-blocklist.py
Created May 26, 2018 13:12
expand-blocklist.py
#!/usr/bin/env python
import csv
import codecs
import urllib.request
import argparse
import ipaddress
def iter_blocked_subnets():
#!/usr/bin/env python3
import csv
import codecs
import urllib.request
import argparse
import ipaddress
def iter_blocked_subnets():
@subuk
subuk / mon.go
Created February 8, 2018 12:05
go simple mon
package main
import (
"bufio"
"io"
"os"
"os/exec"
"time"
)
@subuk
subuk / tilda_export.go
Created January 17, 2018 13:52
Tilda export
package main
import (
"encoding/json"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"