Skip to content

Instantly share code, notes, and snippets.

@rikonor
rikonor / client.rs
Created October 31, 2024 14:27
Log Anomyization
use std::{
sync::Arc,
time::{Duration, Instant, SystemTime, UNIX_EPOCH},
};
use anyhow::{Context, Error};
use async_trait::async_trait;
use ic_agent::{export::Principal, identity::AnonymousIdentity, Agent};
use rand::{rngs::StdRng, SeedableRng};
use rsa::{
@rikonor
rikonor / health_check.py
Last active October 17, 2024 17:20
Ansible health-check module
#!/usr/bin/python
from __future__ import absolute_import, division, print_function
import http.client
import socket
import ssl
import time
from ansible.module_utils.basic import AnsibleModule
__metaclass__ = type
@rikonor
rikonor / Cargo.toml
Created May 30, 2024 16:05
Convert registry snapshot to registry init payload
[package]
name = "tmp"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.86"
clap = { version = "4.5.4", features = ["derive"] }
@rikonor
rikonor / Dockerfile
Last active May 16, 2024 12:59
Reproducible Containers
FROM debian:trixie-20230904-slim
ENV DEBIAN_FRONTEND=noninteractive
# https://snapshot.debian.org/archive/debian/20240515T144351Z/
ARG SNAPSHOT=20240515T144351Z
RUN \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
@rikonor
rikonor / main.py
Created July 21, 2023 21:23
Mock Cloudflare API with CoreDNS Update/Restart
from dataclasses import dataclass, field, fields
from http.server import BaseHTTPRequestHandler as BaseHandler
from http.server import HTTPServer
from typing import IO
from uuid import uuid4
import json
import os
import re
import socket
@rikonor
rikonor / empty_mmdb.pl
Last active September 14, 2022 13:48
Generate empty mmdb files
# run 'mcpan MaxMind::DB::Writer::Tree' beforehand
use MaxMind::DB::Writer::Tree;
use Net::Works::Network;
my %types = ();
my $tree = MaxMind::DB::Writer::Tree->new(
ip_version => 4,
record_size => 24,
@rikonor
rikonor / bootstrap.js
Created August 17, 2021 20:00
[Strapi] Enable Google Provider via Bootstrap
"use strict";
const isFirstRun = async () => {
const pluginStore = strapi.store({
environment: "",
type: "type",
name: "setup",
});
const initHasRun = await pluginStore.get({ key: "initHasRun" });
@rikonor
rikonor / index.js
Created August 15, 2021 20:18
Context + useReducer
import { createContext, useContext, useReducer } from "react";
const initialState = {
isSigningIn: false,
isSignedIn: false,
};
const AuthContext = createContext(initialState);
const reducer = (state, action) => {
@rikonor
rikonor / base.pkr.hcl
Created February 14, 2021 05:25
Packer QEMU Pre-Seeded Debian Image
variable "iso_url" {
type = string
default = "https://cdimage.debian.org/cdimage/release/10.8.0/amd64/iso-cd/debian-10.8.0-amd64-netinst.iso"
}
variable "iso_checksum" {
type = string
default = "file:https://cdimage.debian.org/cdimage/release/10.8.0/amd64/iso-cd/MD5SUMS"
}
@rikonor
rikonor / main.go
Created February 3, 2021 04:43
ETH Convert JSON Keystore to Private Key
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"encoding/hex"
"encoding/json"
"flag"
"fmt"