Skip to content

Instantly share code, notes, and snippets.

@0xKD
0xKD / compress.md
Last active August 16, 2023 08:19
Murphy's Compression

Murphy's Compression

The following compression scheme compresses characters, ignoring whitespace, and utilizes markers like (10x2) to indicate a repetition of the subsequent 10 characters 2 times. The marker itself isn't included in the decompressed output. Parentheses or other characters within the data referenced by a marker are treated as normal data.

Examples of decompression include:

  • MURPHYMURPHY (length 6)
  • (3x3)DBZDBZDBZDBZ (length 9)
  • A(2x2)BCD(2x2)EFGABCBCDEFEFG (length 11)
@0xKD
0xKD / actuallyreadable.css
Created January 12, 2022 13:57
Obsidian readable line length (fix)
/* adjust 60rem to your liking */
.markdown-preview-view.is-readable-line-width .markdown-preview-sizer {
max-width: 60rem;
}
.markdown-source-view.mod-cm6.is-line-wrap.is-readable-line-width .cm-line:not(.HyperMD-table-row) {
max-width: 60rem;
}
@0xKD
0xKD / .gitconfig
Created August 31, 2021 08:26
Conditional .gitconfig
[user]
email = johndoe@gmail.com
name = John
[includeIf "gitdir:~/Work/ACME/gitlab/*/"]
path = ~/Work/ACME/.gitconfig
@0xKD
0xKD / redshift.conf
Created August 31, 2021 07:33
Redshift config for Ubuntu
[redshift]
; Set the day and night screen temperatures
; ---
; From f.lux FAQ
; Ember: 1200K
; Candle: 1900K
; Warm Incandescent: 2300K
; Incandescent: 2700K
; Halogen: 3400K
; Fluorescent: 4200K
@0xKD
0xKD / kitty.conf
Created August 27, 2021 09:53
Kitty Terminal config
# fonts
font_family Comic Mono
font_size 15
# scroll history
scrollback_lines 10000
# window size stuff
remember_window_size yes
initial_window_width 640
@0xKD
0xKD / sql2uml.py
Created July 5, 2021 07:51
SQLAlchemy model to simple PlantUML
import sys
import argparse
import importlib
def format_field(col):
if col.foreign_keys or col.primary_key:
extra = " ({extra})".format(extra="PK" if col.primary_key else "FK")
else:
extra = ""
CREATE USER readonly WITH PASSWORD 'supersecret';
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readonly;
@0xKD
0xKD / cas2tradelog.py
Last active December 24, 2023 05:27
Convert transactions in CAS to tradelog for TMOAP tracker
import argparse
import re
import csv
import decimal
import sys
import logging
from getpass import getpass
import pandas as pd
from decimal import Decimal
@0xKD
0xKD / main.py
Created May 20, 2021 15:15
youdl-gui-bulk
import youtube_dl
from gooey import Gooey, GooeyParser
from youtube_dl import read_batch_urls, preferredencoding
def on_progress(d):
print("", flush=True)
audio_options = {
@0xKD
0xKD / .zshrc
Created May 3, 2021 07:38
Fernet key
alias fernetkey="python3 -c 'import secrets,base64;print(base64.urlsafe_b64encode(secrets.token_bytes(32)).decode())'"