Skip to content

Instantly share code, notes, and snippets.

Making computers do things they don't want to

NightShadow Justasic

Making computers do things they don't want to
View GitHub Profile
Justasic /
Created Mar 24, 2022
Calculate the CRC32 values of Telegram's Type Language constructor IDs
#!/usr/bin/env python3
import sys, re
from zlib import crc32
from typing import Tuple
from PyQt5.QtWidgets import QWidget, QLineEdit, QApplication, QLabel, QVBoxLayout, QHBoxLayout
class Calculator(QWidget):
def __init__(self):
Justasic / .clang-format
Created Jul 14, 2021
My personal clang-format file for C++ (and maybe other languages)
View .clang-format
#BasedOnStyle: WebKit
TabWidth: '4'
IndentWidth: '4'
UseTab: 'ForContinuationAndIndentation'
AlignOperands: 'AlignAfterOperator'
AlignAfterOpenBracket: 'Align'
AlignConsecutiveAssignments: 'AcrossEmptyLinesAndComments'
AlignConsecutiveBitFields: 'AcrossEmptyLinesAndComments'
AlignConsecutiveDeclarations: 'AcrossEmptyLinesAndComments'
View .gitconfig
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
Justasic /
Last active Apr 5, 2022
.run() is bad for libraries

.run() is bad for libraries

As a developer I have noticed a trend in libraries where the library developer will write this amazing library that does everything you need it to except that it has a .run() or .start() method. The intent is for the user of said library to do the initialization code in the application entry point and then do something like return;. Whether it's in Python, Java, C++, or Rust they all abstratct away the application's main event loop.

What is an event loop?

View justasic.zsh-theme
# Color shortcuts
View headers.patch
commit 0e30377471bb47e5600ca544049fd912b8fd6f1f
Author: Justin Crawford <>
Date: Sun Jun 7 05:33:08 2020 +0200
Musl-libc patches
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 8254c937c9f4..0636c2aa487c 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ b/packages/SystemUI/src/com/android/systemui/biometrics/
index ce39fb90889..b82ca3d83b3 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/
@@ -52,7 +52,7 @@ public class FODCircleViewImpl extends SystemUI implements CommandQueue.Callback
// do nothing
mDisableNightMode = SystemProperties.getBoolean("persist.fod.night_mode_disabled", true);
- mDisableGrayscaleMode = SystemProperties.getBoolean("persist.fod.grayscale_mode_disabled", true);
+ mDisableGrayscaleMode = SystemProperties.getBoolean("persist.fod.grayscale_mode_disabled", false);
View LLVM_Musl_install_notes.bash
exit # Dont run this as a script
# LLVM seems to work great on Musl, there only seems some build errors
# when trying to build the sanitizers. So sanitizers have been disabled.
# This is rougly based on this:
# But updated for LLVM 10
# We are also focusing on making a GNU-less toolchain, as there is
# no libgcc and no libstdc++, instead we favor LLVM's own compiler-rt
Justasic / drm_test.c
Created Oct 30, 2019 — forked from uobikiemukot/drm_test.c
dirty and small example of libdrm
View drm_test.c
/* please refer better example: */
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <xf86drm.h>
Justasic / inizh.patch
Last active Jul 8, 2019
This patches Command & Conquer: Generals Zero Hour's inizh.big file to create a GLA super worker which can build all the command centers of all factions (basically a huge cheat)
View inizh.patch
diff -r -u /tmp/Data/INI/CommandButton.ini /DataStorage/Games/Data/INI/CommandButton.ini
--- /tmp/Data/INI/CommandButton.ini 2019-07-05 21:57:33.363905699 -0700
+++ /DataStorage/Games/Data/INI/CommandButton.ini 2019-07-05 21:54:43.440602319 -0700
@@ -2632,6 +2632,15 @@
DescriptLabel = CONTROLBAR:ToolTipGLABuildWorker
+CommandButton Command_ConstructGLASpecialWorker
+ Command = UNIT_BUILD
+ Object = GLASpecialInfantryWorker