Skip to content

Instantly share code, notes, and snippets.

View yassu's full-sized avatar
💭
👨‍💼

yassu yassu

💭
👨‍💼
  • JP
View GitHub Profile
@yassu
yassu / feature_tqdm.py
Created July 3, 2019 18:09
Use feature with tqdm
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tqdm import tqdm
import time
from concurrent.futures import ThreadPoolExecutor
import random
class TaskManager:
def __init__(self, task, args, number_of_max_workers=4):
@yassu
yassu / symmetric-of-complex-numbers.md
Created May 20, 2019 18:16
とある社内のプレゼン資料

複素数の対称性

2019/05/24


Agenda

  • 複素数の定義
  • 複素数の疑問
  • 複素数の構成
import sys.process._
case class Permutation(sigma: Map[Int, Int]) {
val minNumber: Int = sigma.keys.min
val maxNumber: Int = sigma.keys.max
val size: Int = sigma.keys.size
val rangeList: List[Int] = (minNumber to maxNumber).toList
val valueList: List[Int] = rangeList.map(i => sigma(i))
require(minNumber == 0)
This file has been truncated, but you can view the full file.
(headSize, repeatNumber, mod) = (1, 1, 1)
res:
List(Vector(0))
count: 1
================================================================================
(headSize, repeatNumber, mod) = (2, 1, 3)
res:
List(Vector(0), Vector(1, 2))
List(Vector(0), Vector(2, 1))
count: 2
@yassu
yassu / generic_like_pool2.sc
Last active December 23, 2018 05:40
compute original generic_like_pool by recursive
import scala.collection.mutable
object GenericLikePool {
def newDiag(beforeDiag: Seq[Int], num: Int, m: Int): Seq[Int] = {
var s = -1
(0 until beforeDiag.size + 1).map( j => {
s = if(j == 0) num else (beforeDiag(j - 1) - s + m) % m
s
}
(1,1)
List(List(0))
count: 1
==============================
(2,3)
List(List(0, 2), List(1))
List(List(0, 1), List(2))
count: 2
==============================
(3,6)
@yassu
yassu / generic_pool_ball_triangles.scala
Last active December 15, 2018 06:14
Compute generic-like pool ball triangles
object GenericPoolBallTriangles {
def getHeads(values: Seq[Int], m: Int): Set[Seq[Int]] =
values.combinations(m).map(_.permutations).flatten.toSet
def fillPuzzle(headNumbers: Seq[Int], m: Int): Seq[Seq[Int]] = {
def fillPuzzle(values: Seq[Int]): Seq[Seq[Int]] = {
if(values.size == 1) Seq(values)
else Seq.concat(
List(values),
@yassu
yassu / commit-msg
Last active January 31, 2018 15:54
commit-msg file for prefix by coding
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sys import argv, stderr
from string import whitespace
from optparse import OptionParser
PREFIXES = (
'feat',
'fix',
@yassu
yassu / primes.json
Created July 28, 2017 15:02
First 10^6 primes
This file has been truncated, but you can view the full file.
[
2,
3,
5,
7,
11,
13,
17,
19,
23,
@yassu
yassu / memo.txt
Created March 5, 2017 05:41
practical-vim-memo
Section 1
===========
* >G: 現在の行からファイルの最後までのインデントを一段深くする
* A;<esc>という処理は.で繰り返せる
* 複合コマンド:
* C == c$
* S == ^C
* I == ^i
* O == ko