Skip to content

Instantly share code, notes, and snippets.

comm -23 \
<(seq "1" "65535" | sort) \
<(ss -tan | awk '{print $4}' | cut -d: -f2 | tail -n+2 | grep -v '^$' | sort | uniq -u) \
| shuf -n 1
@Hogeyama
Hogeyama / 10-json.conf
Created September 19, 2024 16:37
はじめてのrsyslog
module(load="imudp")
module(load="imtcp")
module(load="mmjsonparse")
# Listen on port 514
input(type="imudp" port="514")
input(type="imtcp" port="514")
template(name="Identity" type="list") {
# GitHubのUIではrebaseすると未解決スレッドを参照するのがとても難しくなるので、コメントに一覧を表示しておく
on:
pull_request:
types:
- opened
- synchronize
pull_request_review_comment:
types:
# TODO コメント追加の度に走るのはまずいかな?2秒で終わっても課金上は1分で計算されるらしい
<script setup lang="ts" generic="T">
import { reactive, ref } from "vue";
import type { Row, TableDef } from "./types";
import { AdjustmentsHorizontalIcon, XMarkIcon } from "@heroicons/vue/24/solid";
const { columns, body, rowError, colError } = defineProps<TableDef<T>>();
// FIXME 効率悪い
const hasAnyError = (row: Row<T>) => {
if (rowError(row)) return true;
@Hogeyama
Hogeyama / TypeSafeBuilder.java
Last active June 7, 2024 15:38
Type-safe Builder in Java
public static class Example {
private final String name;
private final Integer age;
private final String address;
private Example(Builder<Filled, Filled> builder) {
this.name = builder.name;
this.age = builder.age;
this.address = builder.address;
}
@Hogeyama
Hogeyama / NixOSからxz-5.6.xを削除する.md
Last active March 30, 2024 14:42
NixOSからxz-5.6.xを削除する

証明書作成

mkdir -p out
cd out
cat <<EOF > db.cfg
[req]
default_bits = 4096
default_keyfile = db.key
distinguished_name = req_distinguished_name
@Hogeyama
Hogeyama / Dockerfile
Last active March 21, 2023 11:48
Determinate Nix Installer in alpine
FROM alpine:3.17
SHELL ["/bin/ash", "-euo", "pipefail", "-c"]
# shadow for useradd. See https://github.com/DeterminateSystems/nix-installer/issues/284
RUN apk update && apk add --no-cache \
curl=7.88.1-r1 \
shadow=4.13-r0
RUN curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix \
| sh -s -- install linux --init none --no-confirm
RUN \
>> /entrypoint.sh echo '#!/bin/ash' && \
@Hogeyama
Hogeyama / bundle.nix
Last active February 19, 2023 08:26
Poor man's standalone executable
# usage:
# import ./bundle.nix {
# inherit pkgs;
# name = "foo";
# target = "${pkgs.foo}/bin/foo";
# }
{ name
, target
, tempDir ? "/tmp"
, pkgs
@Hogeyama
Hogeyama / docker-compose.yml
Last active January 30, 2023 18:18
serverless-localstack example
# yamllint disable rule:comments
# yamllint disable rule:line-length
---
version: "3.8"
services:
localstack:
image: localstack/localstack:1.3.1
ports:
- "4566:4566"