This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const sleep = msec => new Promise(resolve => setTimeout(resolve, msec)); | |
| (async () => { | |
| console.log('a'); | |
| await sleep(1000); | |
| console.log('b'); | |
| await sleep(1000); | |
| console.log('c'); | |
| await sleep(1000); | |
| console.log('d'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import random as r | |
| count = lambda i : (lambda i, f: f(i, 1, f))(i, lambda i, c, f: f(i, c+1, f) if r() > i else c) | |
| print(count(0.1)) # 10%が成功するまでの回数 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from PIL import Image | |
| class image_aspect(): | |
| def __init__(self, image_file, aspect_width, aspect_height): | |
| self.img = Image.open(image_file) | |
| self.aspect_width = aspect_width | |
| self.aspect_height = aspect_height | |
| self.result_image = None |