Skip to content

Instantly share code, notes, and snippets.

@makiuchi-d
makiuchi-d / sort.bf
Last active January 28, 2025 03:52
BrainfuckでSort
入力4文字
,>,>,>,>
位置合わせbitsとループカウンタ
____ ____ 01110 ___3
>>>> >>>> >+>+>+>> >>>+++
[-<
+++<++<+>> 01110123N ずらしながらループを回すための階段
[
[-<]
@makiuchi-d
makiuchi-d / toupper.bf
Last active October 12, 2024 14:54
ToUpper for Brainf*ck
(10)(11)(12)を1
>>>>>>>>>>+>+>+
<<<<<<<<<<<<
最初の1文字を読んでeofチェック
(0)を255に
>+++++++++++++++ 15
[-<++++++++++++++++>] 16
<+++++++++++++++ 15
(2)に読み込む
@makiuchi-d
makiuchi-d / main.c
Last active May 9, 2024 08:41
TCPで1文字ずつ送信するプログラム (KLabTechBook Vol.13)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
int main(int argc, char **argv)
{
@makiuchi-d
makiuchi-d / main_test.go
Created February 22, 2023 11:51
WSNet2のDictのデシリアライズがunsafe.Stringで20%近く早くなりそう
package main_test
import (
"math/rand"
"testing"
"unsafe"
binary "github.com/KLab/wsnet2-serializer/go"
"golang.org/x/xerrors"
)
@makiuchi-d
makiuchi-d / main.go
Created December 9, 2019 04:59
送信複数、受信1で、送信側が終了するのを確実に待つやつ
package main
import (
"sync"
"fmt"
"time"
"context"
)
type Msg interface{}
@makiuchi-d
makiuchi-d / gist:6615872
Created September 18, 2013 21:17
<input type="file">の画像プレビュー
<html>
<body>
<form method="post" action="#">
<input type="file" id="file1">
<input type="submit" value="ok">
</form>
<img id="thumb">
</body>
<script type="text/javascript">