Skip to content

Instantly share code, notes, and snippets.

View prologic's full-sized avatar
👋
Principal SRE, Founder of Yarn.social and Salty.im

James Mills prologic

👋
Principal SRE, Founder of Yarn.social and Salty.im
View GitHub Profile
@prologic
prologic / Twtxt-IRC-Logs-2023-04-14.txt
Created April 16, 2023 01:49
Twtxt IRC Logs 2023-04-14
[2023-04-14 21:04:08] <westbam0> Hello, small question. Can you read this feed with twtxt?? https://feeds.twtxt.net/@afpfr@amicale.net/twtxt.txt
[2023-04-14 21:05:44] <westbam0> with twtxt in command line, it shows me that
[2023-04-14 21:05:44] <westbam0> ➤ afp_fr (14 hours ago):
[2023-04-14 21:05:44] <westbam0> ****
[2023-04-14 21:19:14] <buckket> They are using a format the original client does not support to do multiline posts
[2023-04-14 21:46:24] <westbam0> buckket And not a way to put in place a treatment to make it compatible?
[2023-04-15 00:52:28] → lain` joined (uid504610@user/lain/x-9874679)
[2023-04-15 00:53:17] → jaix joined (~jaix@user/jaix)
[2023-04-15 01:05:00] → xuu joined (xuu@user/xuu)
[2023-04-15 02:13:11] ⇐ jaix quit (~jaix@user/jaix): Quit: Leaving
@prologic
prologic / test_rpc.dart
Created February 12, 2023 06:48
Test JSON-RPC over UNIX socket in Dart/Flutter
import 'dart:async';
import 'dart:io';
import 'package:json_rpc_2/json_rpc_2.dart';
import 'package:stream_channel/stream_channel.dart';
StreamChannel<String> unixSocketChannel(String path) {
final host = InternetAddress(path, type: InternetAddressType.unix);
final controller = StreamChannelController<String>(sync: true);
Socket.connect(host, 0).then((socket) {
socket.cast<String>().pipe(controller.local.sink);
@prologic
prologic / Dockerfile
Created September 16, 2022 03:00
Docker's behaviour with a relative ENTRYPOINT?
FROM busybox
ENTRYPOINT ["echo", "Hello", "World"]
@prologic
prologic / vaul1t.yml
Last active September 8, 2022 06:11
Vault Cluster on Docker Swarm with Integrated Storage (raft)
---
version: "3.8"
services:
vault:
# image: vault:latest
image: prologic/vault:dev-ui
hostname: "{{.Node.Hostname}}"
environment:
VAULT_ADDR: "http://127.0.0.1:8200"
@prologic
prologic / PortMapping.md
Last active September 7, 2022 02:50
NFTables Port Mapping Example
  1. Create a table named nat with the ip address family:
nft add table ip nat
  1. Add the prerouting and postrouting chains to the table:
nft -- add chain ip nat prerouting { type nat hook prerouting priority -100 \; }
@prologic
prologic / alertrules.yml
Created April 11, 2022 22:34
Prometheus AlertRules
---
groups:
- name: msgbus
interval: 15s
rules:
- alert: zero_subscribers
expr: |
msgbus_bus_subscribers == 0
for: 30s
annotations:
@prologic
prologic / alertrules.yml
Created April 7, 2022 04:17
p95 Traefik Prometheus Alertering Rule
---
- name: traefik
interval: 15s
rules:
- alert: p95_latency
expr: |
label_replace(
histogram_quantile(
0.95,
sum(
@prologic
prologic / main.go
Created April 1, 2022 14:46
Test program to test Go'a netdns=cgo resolver on macOS
package main
import (
"fmt"
"log"
"net"
)
func main() {
cnames, addrs, err := net.LookupSRV("_salty", "_tcp", "home.arpa")
@prologic
prologic / traffic.pql
Created January 5, 2022 02:12
PromQL to measure (for Docker containers via cAdvisor) Network Traffic
sum(label_replace(
increase(container_network_transmit_bytes_total{image!="", container_label_com_docker_stack_namespace=~"$stack", container_label_com_docker_swarm_service_name=~"$service"}[$__range])
+
increase(container_network_receive_bytes_total{image!="", container_label_com_docker_stack_namespace=~"$stack", container_label_com_docker_swarm_service_name=~"$service"}[$__range]),
"task_name", "$1", "container_label_com_docker_swarm_task_name", "(.*\\.[0-9]*).*\\..*")) by (task_name)
@prologic
prologic / gen-yarnd-secrets.sh
Created December 4, 2021 02:49
General yarnd secrets
#!/bin/sh
random_string() {
tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 64 | head -n 1
}
echo " - API_SIGNING_KEY=$(random_string)"
echo " - COOKIE_SECRET=$(random_string)"
echo " - MAGICLINK_SECRET=$(random_string)"