Skip to content

Instantly share code, notes, and snippets.

View dmitmel's full-sized avatar

Dmytro Meleshko dmitmel

View GitHub Profile
#!/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"
  1. 1c
  2. abnf
  3. accesslog
  4. actionscript
  5. ada
  6. angelscript
  7. apache
  8. applescript
  9. arcade
  10. arduino

⬢ ZUI – CGI+DHTML-like User Interface Library for Zsh / ZCurses

This is a RAD (Rapid Application Development) textual user interface library for Zsh. It in many aspects resembles typical CGI+(D)HTML setup. There are:

  • generators ran on "server" side (basic Zshell-code that is just generating text!),
  • event loop that turns the generated text into document with active elements (buttons, anchors, toggle buttons, text fields, list boxes),
  • mechanism to regenerate document parts from the original generators.

So, a Zshell code generates text. It is then turned into document with hyperlinks. DHTML-like calls are possible that will regenerate document parts on the fly. Page can be also reloaded with input data, just like an HTML page.

ZQL draft

Intro

It's a shame that even NixOS, a system with declarative configuration at its core, implements declaring of Bash and Zsh configuration by blocks of text assigned to some configuration fields. This isn't "declaring", it's a regular shell configuration maintenance.

The project and the language behind it – the ZQL – is to solve this problem. Basing on the parser that's built into Zsh and exposed via the (z) flag it will allow to truly declare the contents of shell scripts, being the Bash (Zsh correctly parses a very large subset of Bash syntax) or Zsh startup files, or regular shell scripts.

Below is a draft version of the language. If you'll see any mistakes or inconstences then feel free to report them to r/zplugin subreddit.

@dmitmel
dmitmel / ewa_tool.py
Last active September 23, 2021 18:06
Prototype unpacker utility for Eastward's `.g` archives
#!/usr/bin/env python3
# Based on research from <https://zenhax.com/viewtopic.php?f=9&t=15820#p66444>
from __future__ import annotations
import argparse
import os
import struct
import sys
from enum import Enum
#!/usr/bin/env bash
set -euo pipefail
while true; do
{
rc=0; pgrep nvim || rc="$?"
if (( rc > 1 )); then
exit "$rc"
fi
} | while IFS= read -r pid; do
#!/usr/bin/env python3
import time
import traceback
from random import randrange
from pypresence import Presence # type: ignore
CLIENT_ID = "XXXXXXXXXXXXXXXXXX"
rpc = Presence(CLIENT_ID)
#!/usr/bin/env node
// This is quite literally the last program I've written before I joined the
// crosscode-ru project. The end of an era, so to speak. Just to give you an
// idea, I was literally in the middle of writing this when Dimava made his
// famous post in the #modding channel of the main server.
const os = require('os');
const fs = require('fs');
const path = require('path');