Skip to content

Instantly share code, notes, and snippets.

View TabulateJarl8's full-sized avatar
💭
loving rust

Tabulate TabulateJarl8

💭
loving rust
View GitHub Profile
@TabulateJarl8
TabulateJarl8 / .dialogrc
Last active April 19, 2021 04:08
A dark theme for the command line utility `dialog` that I made. Note: the trailing newline is important
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)
@TabulateJarl8
TabulateJarl8 / input_timeout.py
Last active May 18, 2021 23:47
A Cross-Platform Input Timeout Class
try:
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
TabulateJarl8 / fix_floating_point_errors.py
Last active July 1, 2021 22:05
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
TabulateJarl8 / number.asm
Created December 20, 2023 07:57
I printed an integer in assembly
section .data
str_buffer db 0
section .text
global _start
calculate_ten_power:
; calculate the power of 10 that corresponds to an integer
; for example, 100 for 543, 1000 for 8956, and 10000 for 15236