Skip to content

Instantly share code, notes, and snippets.

View sheepla's full-sized avatar
🐑
メェ〜

sheepla sheepla

🐑
メェ〜
View GitHub Profile
@sheepla
sheepla / shikanoko.fs
Last active June 28, 2024 12:21
🦌 しかのこのこのここしたんたん in F# 🔷
open System
type Pattern =
| Shika
| Noko
| Koshi
| Tan
member self.String() =
match self with
@sheepla
sheepla / shikanoko.rb
Last active June 28, 2024 11:43
🦌 しかのこのこのここしたんたん in Ruby 💎
puts [("しか" * 1), ("のこ" * 3), ("こし" * 1), ("たん" * 2)].join
@sheepla
sheepla / shikanoko.py
Last active June 28, 2024 11:27
🦌 しかのこのこのここしたんたん in Python 🐍
print(
"".join(
[
pair[0] * pair[1]
for pair in [("しか", 1), ("のこ", 3), ("こし", 1), ("たん", 2)]
]
)
)
@sheepla
sheepla / main.hs
Last active June 28, 2024 11:17
しかのこのこのここしたんたん in Haskell
data Pattern = Shika | Noko | Koshi | Tan deriving (Show, Eq)
toString :: Pattern -> String
toString Shika = "しか"
toString Noko = "のこ"
toString Koshi = "こし"
toString Tan = "たん"
generate :: [(Pattern, Int)] -> [String]
@sheepla
sheepla / shikanoko.dot
Last active June 27, 2024 11:47
しかのこのこのここしたんたん.dot
digraph G {
node [shape=circle, fontsize=12];
edge [fontsize=10];
st [label="Start"];
shika [label="しか"];
noko [label="のこ"];
koshi [label="こし"];
tan [label="たん"];
end [label="End"];
@sheepla
sheepla / shikanoko.rs
Last active June 27, 2024 11:53
🦌しかのこのこのここしたんたん in Rust🦀
use std::iter;
fn main() {
iter::repeat(
iter::once("しか")
.chain(iter::repeat("のこ").take(3))
.chain(iter::once("こし"))
.chain(iter::repeat("たん").take(2))
.chain(iter::once("\n")),
)
@sheepla
sheepla / har.jsonschema
Last active June 27, 2024 10:42
JSON Schema for HAR: HTTP Archive (not official specification)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "HTTP Archive (HAR) Schema",
"type": "object",
"properties": {
"log": {
"type": "object",
"properties": {
"version": {
"type": "string"
@sheepla
sheepla / main.rs
Last active June 21, 2024 13:05
HAR: HTTP Archive をパースする
use serde::Deserialize;
use serde::Serialize;
#[derive(Debug, Deserialize, Serialize)]
pub struct Har {
pub log: Log,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct Log {

Goコマンドを強化して使いやすくする

環境

  • Arch Linux
  • go1.22.3 linux/amd64

事前準備

$GOPATH/binにPATHを通しておくこと。

@sheepla
sheepla / Cargo.toml
Last active April 21, 2024 08:17
Search Arch Linux pacakges via official Web interface in Rust
[package]
name = "pacsearch-rs"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
derive_builder = "0.20.0"
reqwest = { version = "0.12.4", features = ["json"] }