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
| # This is the mapping used by wplace.live for storing a user's paid colors, since it's not in the exact same order of the color picker for some reason. | |
| # The key represents the 'colorindex', which is the color's index starting from 0 to 63 (inclusive) in the order of the wplace color picker palette | |
| # The value represents the bit index for an int32 with comments clarifying its real value, or you could compute yourself with the formula pow(2, bitindex) | |
| # You can extract the paid colors a user has bought by bitwise AND'ing the extraColorsBitmap with the selected test color | |
| # extraColorsBitmap can be found inside the data returned by calls to backend.wplace.live/me | |
| extraColorsBitmap-mapping: | |
| 3: 0 # 0x1 | |
| 7: 1 # 0x2 | |
| 9: 2 # 0x4 |
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
| // ==UserScript== | |
| // @name Twitch Auto Switcher | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.9 | |
| // @downloadURL https://gist.githubusercontent.com/dioarya/f73ff308dc1de98ccbd17b8055a1751b/raw/userscript.js | |
| // @updateURL https://gist.githubusercontent.com/dioarya/f73ff308dc1de98ccbd17b8055a1751b/raw/userscript.js | |
| // @description Automatically switches to a live Twitch streamer inside the customizable list, which nth *live* streamer chosen customizable per tab | |
| // @author Arxhield | |
| // @match https://www.twitch.tv/* | |
| // @grant none |
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
| # Take in input from the user. | |
| while True: | |
| num = None | |
| # Check if the input is a valid integer. | |
| try: | |
| # Take in input from the user. | |
| num = input("Input a number: ") | |
| int(num) # Try to turn input into an integer | |
| except ValueError: | |
| print("Please input a correct integer.") |
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
| def heart(n): | |
| s = "" | |
| for i in range(n): | |
| s0 = " " * (n - i - 1) | |
| s1 = "*" * (i * 2 + 1) | |
| s2 = " " * (2 * (n - i) - 1) | |
| s3 = "*" * (i * 2 + 1) | |
| s4 = " " * (n - i - 1) | |
| s += s0 + s1 + s2 + s3 + s4 + "\n" | |
| for i in range(1, n * 2): |
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
| import time | |
| fps = 60 | |
| animation_start = time.perf_counter() | |
| skip_frames = 0 | |
| for framecount, frame in enumerate(animation): | |
| if skip_frames > 0: | |
| skip_frames -= 1 | |
| continue | |
| frame_start = time.perf_counter() |
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
| def hsv_to_rgb(h, s, v) -> tuple[float, float, float]: | |
| # 0 <= h <= 1 | |
| # 0 <= s <= 1 | |
| # 0 <= v <= 1 | |
| c = v * s | |
| x = c * (1 - abs(h*6 % 2 - 1)) | |
| m = v - c | |
| rgb = ( | |
| (c, x, 0), |
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 itertools import product | |
| import math | |
| import random | |
| def smoothstep(t): | |
| return t * t * (3. - 2. * t) | |
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
| def rmod(v: float, minimum: float, maximum: float) -> float: | |
| """modulo with minimum and maximum range | |
| Args: | |
| v (float): value | |
| minimum (float): minimum | |
| maximum (float): maximum | |
| Returns: | |
| float: result |
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
| def lerp(v0, v1, t): | |
| return (1 - t) * v0 + t * v1 | |
| def inv_lerp(a, b, v): | |
| return (v - a) / (b - a) | |
| def remap(min0, max0, min1, max1, value): | |
| return lerp(min1, max1, inv_lerp(min0, nax1, value)) | |
| def remap(v, a0, a1, b0, b1): |