Skip to content

Instantly share code, notes, and snippets.

💤
procrastinating

# Nattawut Phetmak neizod

💤
procrastinating
Last active August 4, 2022 13:27
View artgal.py
This file contains 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
 #!/usr/bin/env python3 size = (1000,1000) polygon = [ (612,661), (668,661), (668,612), (752,757), (668,757), (668,950), (312,334), (284,383), (326,407), (159,407), (201,334), ( 33,238), (745,238), (717,189), (675,213), (759, 68), (801,141), (968, 44), ] guards = polygon[4::6]
Created July 27, 2022 01:24
zooming parabola with infinitely inscribed triangles
View animation.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Last active June 18, 2022 19:00
View monty_hall.py
This file contains 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
 #!/usr/bin/env python3 from random import randrange, shuffle, choice from collections import Counter class Judge(object): def __init__(self): self.doors = ['goat', 'goat', 'CAR'] shuffle(self.doors) # move the prize into a random door
Created June 10, 2022 10:26
proof without words for 1²+2²+3²+...+n² = n(n+1)(2n+1)/6. illustrated with three.js
View draw.js
This file contains 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
 /* * | y * | * . * / \ * z / \ x * */ const scene = new THREE.Scene();
Created April 12, 2022 01:43
Google Code Jam 2022, 1A, Equal Sum
View equal_sum.py
This file contains 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
 #!/usr/bin/env python3 import random UPPER_BOUND = 10**9 BINARY_BOUND = len(f'{UPPER_BOUND:b}') def is_binary(x): return x == 2**len(f'{x:b}')
Created April 3, 2022 04:49
Google Code Jam 2022 -- Qualification Round
View chain_reactions.py
This file contains 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
 import sys from operator import iconcat from functools import reduce sys.setrecursionlimit(100010) class Node(object): def __init__(self): self.fun = 0
Last active October 3, 2021 13:38
View sympy-interval.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Last active September 12, 2021 07:26
View undividable_clique.py
This file contains 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
 #!/usr/bin/env python3 from itertools import combinations def is_undividable_clique(family, number): for subgraph in combinations(family, 4): if sum(subgraph) % number == 0: return False return True
Created September 5, 2021 23:25
View bruteforce-grid.py
This file contains 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
 #!/usr/bin/env python3 # change params here N = 3 M = 3 PRINT_UNIQUE_ANSWERS = True
Last active May 26, 2021 05:29
Megagon SVG!
View generate.py
This file contains 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
 #!/usr/bin/env python3 # NOTE # LAYERS is a non-empty list of integers. # The n-gon can be determine by calc_ngon(LAYERS), e.g., #LAYERS = [1, 2, 2] # heptagon (not constructible) #LAYERS = [1, 4, 3] # heptadecagon (17 sides) #LAYERS = [2, 2, 3, 2] # tetracontadigon (42) #LAYERS = [4, 1, 4, 3, 2, 2] # 360-gon