This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashMap; | |
use lazyrand; | |
use mnist_reader::MnistReader; | |
/// 決定木のノードを表します。 | |
enum Node { | |
Leaf { prediction: u8 }, | |
Decision { | |
feature_index: usize, | |
threshold: f32, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1" /> | |
<!-- PyScriptのライブラリを取り込み --> | |
<link rel="stylesheet" href="https://pyscript.net/releases/2025.3.1/core.css"> | |
<script type="module" src="https://pyscript.net/releases/2025.3.1/core.js"></script> | |
<title>PyScriptでライフゲーム</title> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
from PIL import Image, ImageEnhance, ImageOps, ImageFilter, ImageDraw | |
from pillow_heif import register_heif_opener | |
import TkEasyGUI as eg | |
# HEICが読めるように登録 | |
register_heif_opener() | |
# 画像オブジェクトにセピアフィルタを適用する |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use image::{GenericImageView, imageops::FilterType}; | |
use std::fs; | |
use std::env; | |
// 画素に対応するASCII文字を指定 | |
const ASCII_CHARS: &[u8] = b"@#%8&o*=+-:. "; | |
// RGB値を256色ANSIカラーコードに変換 | |
fn rgb_to_ansi256(r: u8, g: u8, b: u8) -> u8 { | |
let r_idx = (r as u16 * 5 / 255) as u8; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashMap; | |
use std::fs; | |
use regex::Regex; | |
use vibrato::{Dictionary, Tokenizer}; | |
use lazyrand; | |
use std::io::{self, Write}; | |
// 特殊な単語IDを定義 | |
static TOP_WORD_ID: isize = 0; | |
static END_WORD_ID: isize = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import smtplib | |
from email.mime.text import MIMEText | |
from email.mime.multipart import MIMEMultipart | |
from glob import glob | |
# Gmailのアカウント情報を環境変数から読み取る --- (*1) | |
GMAIL_ACCOUNT = os.environ['GMAIL_ACCOUNT'] | |
GMAIL_PASSWORD = os.environ['GMAIL_PASSWORD'] | |
EMAIL_UPLOAD_TO = os.environ["EMAIL_UPLOAD_TO"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// メイン処理 | |
fn main() { | |
println!("{}", digest_to_hex(&sha256(b"hello"))); | |
println!("{}", digest_to_hex(&sha256(b"world"))); | |
println!("{}", digest_to_hex(&sha256(b"cat"))); | |
println!("{}", digest_to_hex(&sha256(b"dog"))); | |
} | |
// ラウンド定数の配列の初期値 | |
const K: [u32; 64] = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"time" | |
"github.com/xuri/excelize/v2" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit ChatGPTUnit; | |
{$mode ObjFPC}{$H+} | |
interface | |
uses | |
fpjson, jsonparser, Process, Classes, SysUtils; | |
function CallChatGPTAPI(const Prompt: string): string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::Read; | |
use std::fs::File; | |
use std::io::{self, BufRead}; | |
use std::path::Path; | |
// 優美番号データファイルの宣言 --- (*1) | |
const FILE_CODE: &str = "zipcode.bin"; // 郵便番号情報のデータ | |
const KEN_TXT: &str = "ken.txt"; // 都道府県 | |
const SHI_TXT: &str = "shi.txt"; // 市区町村 | |
const CHO_TXT: &str = "cho.txt"; // 町域 | |
fn main() { |
NewerOlder