Skip to content

Instantly share code, notes, and snippets.

View dmitmel's full-sized avatar

Dmytro Meleshko dmitmel

View GitHub Profile
import os.path
from typing import Dict, List, TypedDict
import zlib
import json
import os
class SaveData(TypedDict):
introDone: bool
units: List[str]
#!/usr/bin/env python3
# Font patcher for this game: https://store.steampowered.com/app/1056180/Cathedral/
import gzip
import io
import json
import struct
import sys
from typing import Any, Dict, List, TypedDict, cast

This script converts a .world file into a .shipworld file, which will (mostly) be accepted by the game, meaning that you can now have a planet as your entire ship. You will still have to use cheats to add in the necessary ship equipement (SAIL console, fuel tank, captain's chair), but they will all work after placing them down in the world.

The script needs the library py-starbound and sbutils to be installed. Version 1.0.0 of py-starbound has been confirmed to work, but the deal with sbutils is a little bit complicated. I got it to work on the commit https://github.com/xhebox/sbutils/commit/c5d83b0247cacb0789d1e818af74f3c41dc4bbc2 (the latest commit on the master branch as of writing), but it needed the following patch:

--- This used to be in <https://github.com/dmitmel/dotfiles/blob/master/nvim/lua/dotfiles/lsp/markup.lua>.
local M = require('dotfiles.autoload')('dotfiles.lsp.markdown')
local utils = require('dotfiles.utils')
local ffi = require('ffi')
---@type table<string, any>
local lib = ffi.load('cmark-gfm')
---@type table<string, any>
local lib_ext = ffi.load('cmark-gfm-extensions')
@dmitmel
dmitmel / nvim-luv-new-work.lua
Created December 17, 2021 17:31
Example of a semi-practical usage of vim.loop.new_work
local function async_scandir(dirname, callback)
local function work_callback(dirname)
local uv = require('luv')
local fs, err = uv.fs_scandir(dirname)
if err then
return err
end
local entry_names = {}
local entry_types = {}
local i = 0
from typing import cast
from PIL import Image, ImageColor, ImageEnhance
import itertools
import math
import sys
def range_map(
x: float, from_start: float, from_end: float, to_start: float, to_end: float
) -> float:
# docker build --tag dotfiles:ubuntu20.04 .
# docker run --rm --volume "${PWD}:/pwd" --detach --name dotfiles --interactive dotfiles:ubuntu20.04
# docker run --rm --volume "${PWD}:/pwd" --name dotfiles --interactive --tty -e TERM -e COLORTERM dotfiles:ubuntu20.04
# docker exec --interactive --tty -e TERM -e COLORTERM dotfiles
FROM ubuntu:20.04
ENV LC_CTYPE=C.UTF-8 DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get dist-upgrade -y && apt-get install apt-utils && apt-get install -y software-properties-common
RUN \
add-apt-repository ppa:neovim-ppa/stable && \
#!/usr/bin/env python3
# type: ignore
import matplotlib.pyplot as plt
import pynvim
CHUNK_SIZES = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90,
95, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950,
1000, 1250, 1500, 1750, 2000, 2250, 2500, 2750, 3000, 3250, 3500, 3750, 4000, 4250, 4500, 4750,
#!/usr/bin/env python3
# type: ignore
# Some code was taken from Localize-Me-Tools. Thank you, Satcher!
# <https://github.com/L-Sherry/Localize-Me-Tools/blob/d3d124af392da85422d303242e43673a817b360f/readliner.py>.
import os
import readline
from typing import List
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
#include "luv/luv.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"