Skip to content

Instantly share code, notes, and snippets.

View yuk1ty's full-sized avatar

Yuki Toyoda yuk1ty

  • Tokyo, Japan
  • 02:32 (UTC +09:00)
View GitHub Profile
@yuk1ty
yuk1ty / chatgpt.md
Last active December 5, 2022 01:35

ちょうど Advent of Code 2022 を解いていたので、解き終わった問題を ChatGPT に流してみた。使ったのはday1。

https://adventofcode.com/2022/day/1

質問

Santa's reindeer typically eat regular reindeer food, but they need a lot of magical energy to deliver presents on Christmas. For that, their favorite snack is a special type of star fruit that only grows deep in the jungle. The Elves have brought you on their annual expedition to the grove where the fruit grows.

To supply enough magical energy, the expedition needs to retrieve a minimum of fifty stars by December 25th. Although the Elves assure you that the grove has plenty of fruit, you decide to grab any fruit you see along the way, just in case.

質問

あなたは人工知能ですか?

回答

はい、私は人工知能の言語モデルです。私はOpenAIによってトレーニングされており、テキストや音声といった入力を処理し、それらに対して自然な文章を生成することができます。私には知識がありますが、私は実際に経験や観察をすることはできません。

質問

あなたはどのようにして自分が人工知能であると認識しているのですか?

回答

Keybase proof

I hereby claim:

  • I am yuk1ty on github.
  • I am helloyuki (https://keybase.io/helloyuki) on keybase.
  • I have a public key ASBnwv-rMhzxM_6vrgp2p7jXQIh8iISfidPGgHmKTBGkGwo

To claim this, I am signing this object:

@yuk1ty
yuk1ty / validated_str.rs
Last active July 1, 2021 12:15
Create string type validated
use std::{marker::PhantomData, str::FromStr};
use super::error::ValidationError;
pub trait ValidationStrategy {
fn validate(target: &str) -> Result<String, ValidationError>;
}
pub struct NonEmptyString<V>
where
@yuk1ty
yuk1ty / cat.rs
Created March 17, 2021 06:41
Rustハンズオンで使用したコード
// 実行時引数を受け取って cat するプログラム
fn run(path: String) {
match std::fs::read_to_string(path) {
Ok(content) => print!("{}", content),
Err(why) => println!("{}", why),
}
}
fn main() {
let mut args = std::env::args();
match args.nth(1) {
@yuk1ty
yuk1ty / Saga.scala
Created July 1, 2020 17:45
Saga implementation for com.twitter.util.Future
package jp.airtrack.bid.util.saga
import com.twitter.util.Future
import jp.airtrack.bid.util.saga.Saga.SagaErr
sealed abstract class Saga[A] {
def map[B](f: A => B): Saga[B] = flatMap(a => Saga.Succeeded(f(a)))
def flatMap[B](f: A => Saga[B]): Saga[B] = Saga.FlatMap(this, (a: A) => f(a))
@yuk1ty
yuk1ty / IO.scala
Created December 28, 2019 13:14
scratch-io-monad
sealed trait IO[+A] {
import IO._
def map[B](f: A => B): IO[B] = this match {
case Map(original, g, index) if index != 128 =>
Map(original, g.andThen(f), index + 1)
case _ => Map(this, f, 0)
}
@yuk1ty
yuk1ty / future_exercise.rs
Last active July 7, 2019 09:48
Rust 1.36 から入った Future の Runner を作る練習→https://keens.github.io/blog/2019/07/07/rustnofuturetosonorunnerwotsukuttemita/
use std::future::Future;
use std::ops::{Deref, DerefMut};
use std::pin::Pin;
use std::sync::mpsc::{channel, Receiver};
use std::sync::{Arc, Condvar, Mutex};
use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
use std::thread;
pub struct ReturnFuture<T>(Option<T>);
@yuk1ty
yuk1ty / ChainedHashTable.scala
Created December 8, 2018 16:08
アルゴリズムの練習 in Scala
import scala.collection.mutable
import scala.util.Random
case class ChainedHashTable[A](private var t: Array[mutable.ListBuffer[A]],
private var d: Int,
private var n: Int = 0,
private var z: Int)
extends USet[A] {
private[this] lazy val w: Int = 32
@yuk1ty
yuk1ty / main.rs
Created July 27, 2018 14:07
simple interpreter with simple virtual machine
use std::fmt;
use std::cell::RefCell;
pub struct Machine {
pub expression: RefCell<Token>,
}
impl Machine {
pub fn new(expression: Token) -> Self {
Machine {