Skip to content

Instantly share code, notes, and snippets.

@wheresalice
wheresalice / main.go
Last active April 16, 2024 19:39
Decode meshtastic messages from mqtt using meshtastic-go
package main
import (
"encoding/base64"
"encoding/hex"
"fmt"
"github.com/charmbracelet/log"
pb "github.com/meshnet-gophers/meshtastic-go/meshtastic"
"github.com/meshnet-gophers/meshtastic-go/mqtt"
"github.com/meshnet-gophers/meshtastic-go/radio"
package main
import (
pb "buf.build/gen/go/meshtastic/protobufs/protocolbuffers/go/meshtastic"
"crypto/aes"
"crypto/cipher"
"encoding/base64"
"encoding/binary"
"encoding/hex"
"fmt"
@wheresalice
wheresalice / fib.io
Created May 3, 2011 12:01
Fibonacci series in Io language
#!/usr/bin/env io
fib := method(
a := 0
b := 1
for(i, 1, doMessage(call message argAt(0)) - 1, c := a + b; a := b; b := c)
)
fib(10) println
@wheresalice
wheresalice / import.py
Created November 4, 2023 16:17
Create a markdown file for every arms company that CAAT know about
import json
import os.path
import frontmatter
from slugify import slugify
path_to_json_files = 'arms-and-security-fair-exhibitors/data/'
json_file_names = [filename for filename in os.listdir(path_to_json_files) if filename.endswith('.json')]
for json_file_name in json_file_names:
@wheresalice
wheresalice / gist:937d03dd5b11f14c87a95cb33e638f57
Created August 14, 2023 05:01
Obsidian style settings for Blue Topaz
{
"obsidian-default-theme@@color-user-request@@dark": "#6272A4",
"blue-topaz-theme@@font-text-theme": "Archivo,Bookerly,'Inter', 'Segoe UI','霞鹜文楷 GB', 'LXGW WenKai', 'Segoe UI Emoji',var(--font-interface)",
"blue-topaz-theme@@font-family-h5": "Archivo,Bookerly, 'LXGW WenKai', var(--font-interface)",
"blue-topaz-theme@@font-family-h6": "Archivo,Bookerly, 'LXGW WenKai', var(--font-interface)",
"blue-topaz-theme@@font-family-folder-file-title": "Archivo,Arlrdbd, 'Source Han Sans', 'Noto Sans CJK', 'Source Sans Pro', 'Segoe UI Emoji', sans-serif",
"blue-topaz-theme@@font-monospace-theme": "'FiraCode Nerd Font','JetBrains Mono', Consolas, Monaco, '等距更纱黑体 SC', 'Source Han Mono', 'Microsoft Yahei Mono', 'Segoe UI Emoji', 'Microsoft YaHei', 'Source Code Pro', monospace",
"blue-topaz-theme@@font-family-tag": "Archivo,Bookerly, 'Microsoft YaHei', STzhongsong, STSong, 'Segoe UI Emoji', Serif",
"blue-topaz-theme@@font-family-strong": "Archivo,Bookerly,'Inter', 'Segoe UI', 'LXGW WenKai Screen', 'LXGW WenKa
@wheresalice
wheresalice / main.go
Created August 14, 2023 04:38
create a markdown file for each GitHub repo you have starred (no pagination support)
package main
import (
"encoding/json"
"io"
"net/http"
"os"
"path"
"text/template"
"time"
@wheresalice
wheresalice / imgur-to-rimgo.user.js
Last active February 10, 2023 19:43
Redirect Imgur links to rimgo to avoid endless hate scrolling. Working version as of January 2023
/*
DESCRIPTION: This is a file that after installing a greasemonkey
extension can be used to convert imgur to any rimgo instance.
NOTE: I might change this really often because instances may fail.
----
Copyright (C) 2021 Zortazert and other contributors
This program is free software: you can redistribute it and/or modify
@wheresalice
wheresalice / openapi.yaml
Created June 10, 2019 15:53
OpenAPI spec for Confluent Schema Registry
openapi: 3.0.1
info:
title: Schema Registry
version: 5.2.1
description: Schema Registry provides a serving layer for your metadata. It provides a RESTful interface for storing and retrieving Avro schemas. It stores a versioned history of all schemas, provides multiple compatibility settings and allows evolution of schemas according to the configured compatibility settings and expanded Avro support. It provides serializers that plug into Apache Kafka® clients that handle schema storage and retrieval for Kafka messages that are sent in the Avro format.
externalDocs:
url: >-
https://docs.confluent.io/current/schema-registry/develop/api.html#schemaregistry-api
description: Confluent's API reference
paths:
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
@wheresalice
wheresalice / .htaccess
Created February 25, 2011 15:56
webfont .htaccess rules
# ----------------------------------------------------------------------
# Webfont access
# ----------------------------------------------------------------------
# allow access from all domains for webfonts
# alternatively you could only whitelist
# your subdomains like "sub.domain.com"
<FilesMatch "\.(ttf|otf|eot|woff|font.css)$">
<IfModule mod_headers.c>