Skip to content

Instantly share code, notes, and snippets.

@tomowarkar
tomowarkar / download.py
Created March 7, 2021 01:46
url からファイルのダウンロード
import os
import tempfile
import ffmpeg
import requests
from tqdm import tqdm
def download(url, filename):
_, tmpfile = tempfile.mkstemp()
@tomowarkar
tomowarkar / draw.js
Last active February 3, 2021 18:45
The simplest 8bit painting tool written in Pure JS
let size = 16;
let cs = 40;
let arr;
let canvas = document.querySelector("#canvas");
let colorWell = document.querySelector("#colorWell");
let debug = document.querySelector("#debug");
let ctx = canvas.getContext("2d");
startup = () => {
@tomowarkar
tomowarkar / matmul.go
Created February 3, 2021 16:04
Golang matrix multiplication
package main
import (
"fmt"
"reflect"
"strconv"
)
type matrix [][]int
@tomowarkar
tomowarkar / Download Test.html
Created February 2, 2021 20:16
文字列をファイルとしてダウンロードするJavaScript
<!DOCTYPE html>
<html>
<head>
<title>Download Test</title>
</head>
<div>
<textarea id="input-text" rows="10" cols="60">Download Test</textarea>
<button id="btn">download</button>
</div>
@tomowarkar
tomowarkar / imageDownloader.py
Created January 18, 2021 21:18
自動的に拡張子を設定して保存してくれるとラクだと思った
import os
import time
import requests
class DownloaderError(Exception):
pass
@tomowarkar
tomowarkar / timer.py
Last active January 12, 2021 11:00
My simple timer
import time
class Timer:
_events = []
def _add_event(self):
"""Add a event time recode"""
self._events.append(time.perf_counter())
@tomowarkar
tomowarkar / prim.go
Last active December 5, 2020 11:01
Golang プリム法
package main
import "fmt"
import "bufio"
import "bytes"
var r *bufio.Reader
var testCases = []struct {
stdin string
import subprocess as sp
from copy import deepcopy
from random import choice
from typing import List, Tuple
from pynput.keyboard import Key, Listener
Matrix = List[List[int]]
SQR_N = 4