Skip to content

Instantly share code, notes, and snippets.

diff --git a/t/50connect-eyeballs.t b/t/50connect-eyeballs.t
index 832c1b051..717ac0729 100644
--- a/t/50connect-eyeballs.t
+++ b/t/50connect-eyeballs.t
@@ -1,5 +1,6 @@
use strict;
use warnings;
+use File::Temp qw(tempdir);
use IO::Socket::IP;
use Test::More;
#include <stdint.h>
#include <stdio.h>
#include <openssl/engine.h>
#include <openssl/provider.h>
#include "picotls.h"
#include "picotls/openssl.h"
int main(int argc, char **argv)
{
OSSL_PROVIDER *legacy = OSSL_PROVIDER_load(NULL, "legacy");
@kazuho
kazuho / llmproxy.js
Last active May 9, 2025 01:36
proxy that adds function call capabilities to llama.cpp server
// proxy.js
// Express server wrapping llama.cpp server with OpenAI function-calling semantics
// Logs client requests/responses and model requests/responses to console
const express = require('express');
const axios = require('axios');
const bodyParser = require('body-parser');
const { v4: uuidv4 } = require('uuid');
const { spawn } = require('child_process');
@kazuho
kazuho / addmib.pl
Last active March 1, 2025 06:57
tiny memory load generator
#! /usr/bin/perl
use strict;
use warnings;
while (my $l = <STDIN>) {
chomp $l;
if ($l !~ /MiB/ and $l =~ /([0-9]+,[0-9,]+)/) {
$l .= toMiB($1);
}
@kazuho
kazuho / freespace.rb
Last active July 4, 2024 07:37
calculate amount of disk space returned, once all the given files and directories are removed
#!/usr/bin/env ruby
require 'find'
BLOCK_SIZE = 512 # ブロックサイズは通常 512 バイト
def calculate_freed_space(paths)
inodes = {}
total_blocks = 0
processed_files = {}
@kazuho
kazuho / sshd-tcpd.socket
Last active July 3, 2024 14:29
sshd + tcp wrappers
# こいつは systemctl enable sshd-tcpd.socket する
[Unit]
Description=ssh
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
Conflicts=ssh.socket
[Socket]
ListenStream=22
Accept=yes
@kazuho
kazuho / nespresso.scad
Created January 8, 2024 10:34
Nespressoカプセルホルダ(OpenSCAD形式)レイヤ0.2mm前提
Rtop = 12;
Htop = 25;
Rin = 15;
Rout = 20;
H = 2 + (Rout - Rin) / 1.5;
thick = 1.2;
rows = 7;
cols = 5;
for (i = [0:cols - 1]) {
# 必要なモジュールのインポート
import numpy as np
import scipy.stats as stats
# カウントされた足の本数
counts = np.array([57, 62, 63, 60, 57, 60, 58, 60, 61, 62])
# つるとかめの個体数は合計で20匹
total_animals = 20
2752512 bytes alive from 0x7f8e184d27d1, alloc=84, free=0, collision=0
X509_VAL_it at ??:?
SSL_set_ciphersuites at ??:?
966000 bytes alive from 0x7f8e185b746e, alloc=29642, free=26548, collision=0
CRYPTO_zalloc at ??:?
229376 bytes alive from 0x7f8e184d27d1, alloc=7, free=0, collision=0
X509_VAL_it at ??:?
diff --git a/src-main/context.c b/src-main/context.c
index d84858c..08a0de5 100644
--- a/src-main/context.c
+++ b/src-main/context.c
@@ -594,7 +594,7 @@ anthy_save_history(const char *fn, struct anthy_context *ac)
dprintf(fd, "\n");
/**/
errno = 0;
- if (fchmod(fd, S_IREAD | S_IWRITE)) {
+ if (fchmod(fd, S_IRUSR | S_IWUSR)) {