Skip to content

Instantly share code, notes, and snippets.

learning rust

Tabulate TabulateJarl8

learning rust
View GitHub Profile
TabulateJarl8 /
Last active Jul 1, 2021
Simple decorator to fix floating point arithmetic errors in your function
import inspect # For getting the source of the decorated function
import tokenize # For tokenizing each line of the decorated function
import io # Used to read the line of code into the tokenizer
import decimal # Used for fixing floating-point errors
def decistmt(s):
# Function for parsing a line of code and making all floats into decimal objects
# List containing all tokens of new statement
result = []
TabulateJarl8 /
Last active May 18, 2021
A Cross-Platform Input Timeout Class
import msvcrt, time # Windows
except ModuleNotFoundError:
import select # Unix
import sys
class TimedInput:
def input(self, text, timeout_s, default=None):
if 'select' in sys.modules:
TabulateJarl8 / .dialogrc
Last active Apr 19, 2021
A dark theme for the command line utility `dialog` that I made. Note: the trailing newline is important
View .dialogrc
aspect = 0
separate_widget = ""
tab_len = 0
visit_items = OFF
use_shadow = OFF
use_colors = ON
screen_color = (WHITE,DEFAULT,OFF)
shadow_color = (WHITE,WHITE,OFF)
dialog_color = (WHITE,BLACK,OFF)
title_color = (CYAN,BLACK,OFF)