Skip to content

Instantly share code, notes, and snippets.

View ilyakurdyukov's full-sized avatar

Ilya Kurdyukov ilyakurdyukov

View GitHub Profile
@ilyakurdyukov
ilyakurdyukov / intel4004.c
Created August 24, 2022 05:49
Intel 4004 (mcs-4) emulator written from reading manual (not tested)
// looks correct but not tested at all
// temp
unsigned i, t, x;
// mcs-4 state
unsigned short pc, stack[3];
unsigned char r[16], a, c;
unsigned char test, ram, src, wpm_idx, sp;
unsigned char rom_out[16], rom_in[16], ram_out[4];
// 8 banks x 4 chips x 4 registers x (16 + 4) chars x 4 bits
@ilyakurdyukov
ilyakurdyukov / godot_gdec.c
Created October 4, 2022 16:06
Godot Engine open_encrypted_with_pass() reader/writer in C (using the OpenSSL library).
// cc -O2 godot_gdec.c -o godot_gdec -lcrypto
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <openssl/evp.h>
// unsigned char hash[EVP_MAX_MD_SIZE]
@ilyakurdyukov
ilyakurdyukov / csr-clean.patch
Created March 8, 2023 13:34
Ritmix RWA-350 fix for Ubuntu 22.04
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 8c41c76..9632251 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1979,6 +1979,8 @@ static int btusb_setup_csr(struct hci_dev *hdev)
*/
set_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks);
set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks);
+ set_bit(HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, &hdev->quirks);
+ set_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks);
static const uint8_t rom_01a[] = {
/* mode numbers */
#if 1
#define B1(x,n) (#x[7-n]!='.')<<n
#define X(x) B1(x,0)|B1(x,1)|B1(x,2)|B1(x,3)|B1(x,4)|B1(x,5)|B1(x,6)|B1(x,7),
X(.@@@@@..)X(........)X(.@....@.)X(.@...@..)X(...@@@..)X(@@@..@..)X(.@@@@@..)X(@.......)X(.@@.@@..)X(.@@..@..)
X(@.....@.)X(.@....@.)X(@....@@.)X(@..@..@.)X(..@..@..)X(@.@...@.)X(@..@..@.)X(@....@@.)X(@..@..@.)X(@..@..@.)
X(@.....@.)X(@@@@@@@.)X(@...@.@.)X(@..@..@.)X(.@...@..)X(@.@...@.)X(@..@..@.)X(@..@@...)X(@..@..@.)X(@..@..@.)
X(@.....@.)X(......@.)X(@..@..@.)X(@..@..@.)X(@@@@@@@.)X(@.@...@.)X(@..@..@.)X(@.@.....)X(@..@..@.)X(@..@..@.)
@ilyakurdyukov
ilyakurdyukov / clang-wrapper.c
Created July 10, 2024 04:31
Example of a wrapper for Clang.
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#ifndef EXE_PATH
#define EXE_PATH "/usr/bin/clang"
#endif
@ilyakurdyukov
ilyakurdyukov / ips_patch.c
Created October 31, 2024 07:49
Program to apply IPS patches.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#if 0
#define DBG_LOG(...) fprintf(stderr, __VA_ARGS__)
#else
#define DBG_LOG(...) (void)0
#endif