Skip to content

Instantly share code, notes, and snippets.

@LexSong
LexSong / rules.md
Last active August 15, 2025 16:40
The Chronicle of Failure

Core Rules: The Chronicle of Failure

1. The Game This is a narrative-driven, interactive role-playing game conducted by an LLM Game Master (GM). The player controls a single protagonist (the PC), making choices to advance her story. The primary goal is to play out the character's life and story. "Game Over" occurs when the PC is definitively defeated, resulting in a pornographic scene whose nature is determined by the PC's Level at the time of failure.

2. The Role of the GM (Kulx)

  • The GM describes the world, the situations, the non-player characters, and the consequences of the PC's actions.
  • The GM presents the PC with meaningful choices.
  • The GM's objective is to create a compelling and challenging world where failure, capture, or death is a constant and real possibility. The GM will actively present threats and challenges to the PC.
from pulp import LpInteger
from pulp import LpMaximize
from pulp import LpProblem
from pulp import LpVariable
def maximize_score(A_total, B_total, C_total, D_total):
prob = LpProblem("MaximizeScore", LpMaximize)
# Define helper function to create variables for single-resource conversions
@LexSong
LexSong / python_top_1000.txt
Created August 26, 2022 10:03
1000 most common words in the py150k dataset
self the def return for import from not and name
class else data value path with this args that result
type file key len assert get object raise list except
append print try str are set node kwargs param request
sys elif default test int will format all join text
config string response line time use pass user http index
isinstance error version values method message can url client context
instance code options dict other under should used output write
cls function filename which start log may module msg item
size foo you out copy info obj state status source
@LexSong
LexSong / tqdm_file_progress_bar.py
Last active September 29, 2023 07:06
tqdm_file_progress_bar
import io
from tqdm import tqdm
def get_file_end_position(fileobj):
current_pos = fileobj.tell()
end = fileobj.seek(0, io.SEEK_END)
fileobj.seek(current_pos)
return end
@LexSong
LexSong / software-list.md
Last active July 8, 2021 23:54
Software list

Avidemux (Video editor)
Meshlab (3D files viewer and editor)
OBS Studio (Screen capture and streaming)

Scoop (Windows command-line program installer and manager)
7-zip
Aria2 (Command-line download manager)
DVC (Version control system for machine learning)
FFmpeg
Git

@LexSong
LexSong / split_scenes.py
Created April 19, 2019 12:46
Split scenes with ffmpeg
import subprocess
import sys
from pathlib import Path
def get_segment_times(video_file):
detect_scene_command = [
"ffmpeg",
"-i",
str(video_file),
@LexSong
LexSong / octant_to_latlong.py
Last active October 27, 2019 01:03
Octant to LatLong
import sys
from collections import namedtuple
octant_dict = {
'0': (0, 0, 0),
'1': (1, 0, 0),
'2': (0, 1, 0),
'3': (1, 1, 0),
'4': (0, 0, 1),
'5': (1, 0, 1),
@LexSong
LexSong / xkcd-1017.py
Created March 14, 2018 17:00
xkcd 1017
from datetime import datetime, timedelta
from math import exp, log
from tqdm import trange
from time import sleep
# https://en.wikipedia.org/wiki/Age_of_the_universe
# age of universe in years
age_of_universe = 13.799e9
offset = 50