Skip to content

Instantly share code, notes, and snippets.

@kawasin73
kawasin73 / tokyo_metoro_nikkei.md
Created December 23, 2016 18:51
東京メトロ 日経新聞三国志広告の旅
@kawasin73
kawasin73 / README.md
Created August 23, 2017 09:56
goroutine leaks

goroutine がリークする

goroutineは終了しているものの、goroutineがGCされていないようです。

即座にgoroutineが終了(つまり同時に存在するgoroutineの数が多くない)する場合は、ちゃんとGCするみたい。 大量のgoroutineが同時に存在するとGCできずにリークするみたい。

@kawasin73
kawasin73 / sample.ino
Created March 17, 2018 08:41
sample.ino がArduinoのコード、sample.rbがRubyのコード
#include <Servo.h>
Servo myservo; //initiareze a servo for the connected servo: servoに名付ける
/*HS-5070MH Servo
Voltage=const:6.0-7.4V
Torque:3.1-3.8kg・cm*/
int Angle = 0; //the set point of the angle to zero: Servoへのcommand値
int myangle[3]={10,20,30}; //variable to control
@kawasin73
kawasin73 / file_lock_with_timeout.go
Last active May 21, 2022 11:38
FileLock with timeout using Fcntl in Golang
package main
import (
"errors"
"io"
"log"
"os"
"os/signal"
"syscall"
"time"
@kawasin73
kawasin73 / ipsock.go
Created August 9, 2019 05:47
ipsock を試した
package main
import (
"log"
"net"
"sync"
"time"
)
func main() {
"""
This file is based on https://github.com/foresmac/django-binaryuuidfield/tree/initial-setup
"""
import uuid
from django import forms
from django.core import exceptions
from django.db import models
from django.utils.translation import ugettext_lazy as _
@kawasin73
kawasin73 / converter-bench.py
Last active September 21, 2019 10:55
video metadata parse benchmark of cv2, VideoConverter, Imageio
"""
$ pipenv install git+https://github.com/senko/python-video-converter.git#egg=VideoConverter
"""
import converter
def get_meta(path):
c = converter.Converter()
return c.probe(path)
@kawasin73
kawasin73 / tanuki_gzip.go
Last active February 2, 2020 11:01
SECCON 2019 tanuki
package main
import (
"compress/gzip"
"crypto/sha1"
"encoding/base64"
"hash"
"hash/crc32"
"io"
"log"
property
w int
r int
mu sync.Mutex
rwmu sync.RWMutex
rlock
mu.lock
r++
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"sync"