Skip to content

Instantly share code, notes, and snippets.

Avatar
🏍️
Making computers do things they don't want to

NightShadow Justasic

🏍️
Making computers do things they don't want to
View GitHub Profile
@Justasic
Justasic / TLCRC.py
Created Mar 24, 2022
Calculate the CRC32 values of Telegram's Type Language constructor IDs
View TLCRC.py
#!/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):
super().__init__()
@Justasic
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
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
@Justasic
Justasic / message.md
Last active Apr 5, 2022
.run() is bad for libraries
View message.md

.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 app.run();. 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
RED=$fg[red]
YELLOW=$fg[yellow]
GREEN=$fg[green]
WHITE=$fg[white]
BLUE=$fg[blue]
RED_BOLD=$fg_bold[red]
YELLOW_BOLD=$fg_bold[yellow]
GREEN_BOLD=$fg_bold[green]
WHITE_BOLD=$fg_bold[white]
View headers.patch
commit 0e30377471bb47e5600ca544049fd912b8fd6f1f
Author: Justin Crawford <Justin@stacksmash.net>
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
View FODCircleViewImpl.java.diff
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java b/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java
index ce39fb90889..b82ca3d83b3 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java
@@ -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:
# https://wiki.musl-libc.org/building-llvm.html
# 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
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: https://github.com/dvdhrm/docs/tree/master/drm-howto/ */
#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
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
End
+CommandButton Command_ConstructGLASpecialWorker
+ Command = UNIT_BUILD
+ Object = GLASpecialInfantryWorker