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
# fnt2cfg.py v0.1 ~tomekzaw 2022 | |
# https://gist.github.com/tomekzaw/ac3aa4942587869119dd926da024b6e9 | |
import argparse | |
from pathlib import Path | |
def fnt2cfg(d: bytes) -> bytes: | |
d = bytearray(d) | |
for i in 2, 105, 113: |
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
#include <jsi/jsi.h> | |
#include "Promise.h" | |
using namespace facebook; | |
namespace swmansion::jsiutils::Promise { | |
jsi::Value createFromHostFunction(jsi::Runtime &rt, Executor &&executor) { | |
return rt.global() |
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 dataclasses import dataclass | |
from datetime import datetime, timedelta | |
from typing import Generic, TypeVar, Callable, Optional | |
T = TypeVar('T') | |
@dataclass | |
class Cache(Generic[T]): | |
func: Callable[[], 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
try: | |
from signal import pause | |
except ImportError: | |
def pause(): | |
from time import sleep | |
try: | |
while True: | |
sleep(1) | |
except KeyboardInterrupt: | |
pass |
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 fix_scaling(): | |
import sys | |
if sys.platform == 'win32': | |
try: | |
import ctypes | |
PROCESS_SYSTEM_DPI_AWARE = 1 | |
ctypes.OleDLL('shcore').SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE) | |
except (ImportError, AttributeError, OSError): | |
pass |
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 time import time, sleep | |
from itertools import count | |
def tick(seconds, n=None, timefunc=time.time): | |
start = timefunc() | |
yield start | |
gen = count(1) if n is None else range(1, n) | |
for i in gen: | |
while True: |
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
<?php | |
set_time_limit(5); | |
error_reporting(0); | |
function in_range($num, ...$ranges) { | |
foreach ($ranges as $range) { | |
if (is_array($range)) { | |
if ($range[0] <= $num and $num <= $range[1]) { | |
return true; |