Skip to content

Instantly share code, notes, and snippets.

View konabe's full-sized avatar
🛰️
Working from home

konabe konabe

🛰️
Working from home
View GitHub Profile
@konabe
konabe / dice.kt
Created February 19, 2021 02:28
Iterableでサイコロ in kotlin https://pl.kotl.in/6HQZd-k51
/**
* You can edit, run, and share this code.
* play.kotlinlang.org
*/
import kotlin.random.Random
class DiceIterator(
val time: Int = 0
): Iterator<Int> {
@konabe
konabe / main.py
Created July 13, 2019 03:11
藤枝市の人口データ取得
from bs4 import BeautifulSoup
from urllib import request, error
from time import sleep
import re
import os
import pickle
import pandas as pd
from datetime import date
from matplotlib import pyplot as plt
import japanize_matplotlib
@konabe
konabe / example.sol
Created June 15, 2019 11:26
Solidity記念
pragma solidity >=0.4.0 <0.7.0;
contract SimpleStorage {
uint storedData;
function set(uint x) public {
storedData = x;
}
function get() public view returns (uint) {
@konabe
konabe / jounotyuunoge.py
Created June 11, 2019 23:08
上の中の下という言い方が相対的にどれくらいの位置なのかを出力する
rank = ["上", "中", "下"]
category = ["の".join([i, j, k]) for i in rank for j in rank for k in rank]
score = [(c, str(len(category)-i-1)+"/"+str(len(category)-1), (len(category)-i-1)/(len(category)-1)) for i, c in enumerate(category)]
for s in score:
print(s[0], s[1], "{:.3f}".format(s[2]), "{:.1f}点".format(s[2]*100))
package main
import(
"golang.org/x/tour/tree"
"fmt"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int){
package main
import (
"golang.org/x/tour/pic"
"image/color"
"image"
)
type Image struct{
w int
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
package main
import "fmt"
// 食べるためのインターフェース
type Eatable interface{
PutIn() // 口に入れる
Chew() // 噛む
Swallow() // 飲み込む
}
package main
import "golang.org/x/tour/reader"
type MyReader struct{}
// TODO: Add a Read([]byte) (int, error) method to MyReader.
func (m MyReader) Read(rb []byte) (n int, e error) {
for n, e = 0, nil; n < len(rb); n++ {
rb[n] = 'A'
package main
import (
"fmt"
"math"
)
type ErrNegativeSqrt float64
func (e ErrNegativeSqrt) Error() string {