Skip to content

Instantly share code, notes, and snippets.

@noqisofon
noqisofon / squad-output.cpp
Last active March 20, 2025 04:15
( ノ╹◡◡╹)ノ 🦑を C++ で表示してみた
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#include <Windows.h>
auto main() -> int {
wchar_t buffer[256] = {};
@noqisofon
noqisofon / choice
Created February 9, 2025 08:08
( ノ╹◡◡╹)ノ ファイルの内容からランダムに大体 6 行表示するかもしれない
#!/usr/bin/perl
# -*- mode: perl; -*-
use v5.38.2;
use Data::Entropy::Algorithms qw(rand_int choose_r);
use Getopt::Long;
use Path::Class;
use Pod::Usage;
my $amount = rand_int(6) + 1;
my $help = 0;
@noqisofon
noqisofon / random_extensions.hxx
Created December 14, 2024 01:57
( ノ╹◡◡╹)ノ Raku の `.pick` と `.roll` を C++ で再現してみた
#pragma once
#include <random>
int32_t pick( std::mt19937_64 &engine, int32_t min, int32_t max ) {
std::uniform_int_distribution<> dist( min, max );
return dist( engine );
}
@noqisofon
noqisofon / example-back-inserter.cpp
Last active December 14, 2024 01:21
( ノ╹◡◡╹)ノ `std::back_inserter` の使い方
#include <vector>
#include <iostream>
#include <random>
#include <string>
constexpr auto CAPACITY = 1024;
int main() {
std::random_device seed_generator;
std::mt19937_64 engine{ seed_generator() };
@noqisofon
noqisofon / gen-wiz-chara000.raku
Created November 12, 2024 12:12
( ノ╹◡◡╹)ノ 生成されたキャラの名前を 6 から 12 個抜き出して、wiz なキャラ設定を付けてくかもしれない
my @katakana-female-names = './katakana-female-names000.tsv'.IO.lines;
my @katakana-male-names = './katakana-male-names000.tsv'.IO.lines;
my @klasses = <戦士 盗賊 僧侶 魔法使い 侍 君主 司教>;
my @sexes = <男 女>;
my @alignment = <善 中立 悪>;
my @races = <人間 ドワーフ エルフ ホブ ノーム>;
my $generate-amount = (6..12).pick;
@noqisofon
noqisofon / 0_make-list-all-file.bash
Last active November 1, 2024 06:18
( ノ╹◡◡╹)ノ いんすとろーるされてるパッケージの依存関係をグラフで見たい気もする
# `pkg-config.list-all.txt` を作成します。
pkg-config --list-all | sort -u > ./pkg-config.list-all.txt
# おまけで `./digraph` ディレクトリを作るかもしれない。
mkdir ./digraph
@noqisofon
noqisofon / chatgpt000.session.log
Created September 14, 2024 03:07
٩(′д‵)۶
User
``` scheme
(define-syntax dolist
(syntax-rules ()
((_ (it seq result))
(let loop ((xs seq))
(if (null? xs)
result
(begin
(let ((it (car xs)))
@noqisofon
noqisofon / example-dolist.scm
Created September 14, 2024 03:00
( ノ╹◡◡╹)ノ くりかえしまくろ~~~~
(include "./reiteration.scm")
(dolist (i '(0 1 2 3 4 5 6 7 8 9))
(display i)
(display " "))
@noqisofon
noqisofon / sort-example.exs
Created July 13, 2024 02:55
( ノ╹◡◡╹)ノ 多分 Elixir でソートするかもしれないやつ
defmodule Example.Sort do
def sort([]), do: []
def sort([head | tail]), do: insert(head, sort(tail))
defp insert(elt, lst) do
case lst do
[] ->
[elt]
@noqisofon
noqisofon / Collaborative_Storytelling.log
Last active June 30, 2024 06:37
( ノ╹◡◡╹)ノ ChatGPT ちゃんとコラボレーティブストーリーテリングをした例
User
コラボレーティブストーリーテリングをしましょう。
私が舞台、主要キャラクター、テーマ、プロットのはじめの方を書くので、あなたがプロットの続きを少しだけ考え、私がその後に少しだけ考え…という風に続けていきましょう。
- 舞台 :: 中世ファンタジー世界のデュランタ市周辺
- 主要キャラクター :: 不明
- テーマ :: デュランタ聖戦
- プロットのはじめの方 ::
デュランタ市は複数の宗教における聖地とされ、長くロシティ教ミポフォル派が支配していたが、フォルピピ神殿騎士団の軍勢に包囲されつつあった