Skip to content

Instantly share code, notes, and snippets.

View CoelacanthusHex's full-sized avatar
☹️
Depression

Coelacanthus CoelacanthusHex

☹️
Depression
View GitHub Profile
@Cryolitia
Cryolitia / sig2dot.py
Last active April 5, 2024 14:51
sig2dot.py
# Visualize GnuPG Trust Web
# usage: gpg --list-sigs | python3 ./sig2dot.py
import fileinput
import re
import networkx
from matplotlib import pyplot
lines = [i for i in fileinput.input() if not i.startswith('sub')]
# lines = [i for i in open("gpg.txt", "r").readlines() if not i.startswith('sub')]
@FYHenry
FYHenry / steam.6
Created April 7, 2023 23:40
Better steam(6) manpage
.\" Edited by Alnotz.
.\" 2023-04-02
.TH "STEAM" "6" "2023-04-02" "Valve" "Steam Launcher's Manual"
.SH "NAME"
steam \- A launcher for the Steam client from Valve Corporation
.SH "SYNOPSIS"
@berberman
berberman / Gen.hs
Created May 27, 2022 22:47
Fcitx 5 Quick Phrase for Agda Input
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wall #-}
module Gen where
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Data.Void (Void)
#!/usr/bin/env bash
echo dump | socat stdio tcp6:[::1]:33123 | awk '
BEGIN {
i = 0
ORS = ""
}
{
if ($2 == "route" && $9 == "yes") {
if (i == 0) {
print "if "
@ksyx
ksyx / README.md
Created December 10, 2021 20:14
A toy that stores some global variables by writing the binary itself

Global Variable Storage

Background

VBA could store some data by simply putting those data into Excel cells or Powerpoint TextBoxes, which is kinda counterintuitive for a programming language to have persist value storage even after stopped running, though perfectly reasonable. Could we do similar thing in the magical C++? This heavily platform dependent toy (ELF + POSIX) achieves this.

Working principle

It simply utilizes the .data segment by either specifying some variables to be put there, or just utilize the fact that initialized values are put there. Some magical operations used:

  • The variables __data_start and edata provided by linker scripts
  • Read output of awk with popen

License

MIT License

@dallaslu
dallaslu / sort_by_time.py
Created October 20, 2021 04:07
Sort Beancount Entries by meta['time']
"""Sort Beancount Entries by meta['time']
Although beancount says that time is meaningless, there are situations
where an account that should not be negative may have a negative balance
at some point because transfers that occurred on the same day are
scheduled later and spending records are scheduled earlier.
This is not a big deal, but it is a bit odd.
2021-10-01 balance Assets:Cash 500 USD
@probonopd
probonopd / Wayland.md
Last active May 3, 2024 23:46
Think twice about Wayland. It breaks everything!

Think twice before abandoning Xorg. Wayland breaks everything!

Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.

Wayland proponents make it seem like Wayland is "the successor" of Xorg, when in fact it is not. It is merely an incompatible alternative, and not even one that has (nor wants to have) feature parity (missing features). And unlike X11 (the X Window System), Wayland protocol designers actively avoid the concept of "windows" (making up incompr

@graninas
graninas / What_killed_Haskell_could_kill_Rust.md
Last active March 18, 2024 14:57
What killed Haskell, could kill Rust, too

At the beginning of 2030, I found this essay in my archives. From what I know today, I think it was very insightful at the moment of writing. And I feel it should be published because it can teach us, Rust developers, how to prevent that sad story from happening again.


What killed Haskell, could kill Rust, too

What killed Haskell, could kill Rust, too. Why would I even mention Haskell in this context? Well, Haskell and Rust are deeply related. Not because Rust is Haskell without HKTs. (Some of you know what that means, and the rest of you will wonder for a very long time). Much of the style of Rust is similar in many ways to the style of Haskell. In some sense Rust is a reincarnation of Haskell, with a little bit of C-ish like syntax, a very small amount.

Is Haskell dead?

@Aloxaf
Aloxaf / fcitx5-diagnose.sh
Created July 4, 2020 02:20
实验性的 fcitx-diagnose for fcitx5
#!/usr/bin/env bash
shopt -s extglob nullglob globstar
export TEXTDOMAIN=fcitx5
__test_bash_unicode() {
local magic_str='${1}'$'\xe4'$'\xb8'$'\x80'
local magic_replace=${magic_str//\$\{/$'\n'$\{}
! [ "${magic_str}" = "${magic_replace}" ]
}

Merging Rubygems and Bundler

1.sh:

#!/bin/sh
set -eux
rm -rf rubygems bundler
git clone https://github.com/rubygems/rubygems
git clone https://github.com/rubygems/bundler