Skip to content

Instantly share code, notes, and snippets.

View alexlnkp's full-sized avatar
:fishsticks:
fishsticks

Alex Murkoff alexlnkp

:fishsticks:
fishsticks
View GitHub Profile
@alexlnkp
alexlnkp / instructions
Last active January 26, 2025 02:25
gpu-screen-recorder on Hyprland
This is an unofficial guide I wrote myself to let more people learn about this wonderful thing.
The instructions will be mostly listed for Arch Linux, however sources provided also
include step by step tutorial for any other distribution.
Most importantly, this is not a 100% complete guide,
moreso just an overview of a setup you can have.
If you're having issues - consult with the README in the git tree.
https://git.dec05eba.com/gpu-screen-recorder/about/
STEP BY STEP GUIDE ON GPU-SCREEN-RECORDER ON LINUX
@alexlnkp
alexlnkp / C-POSIX-SHM
Last active November 19, 2024 17:48
A (bad) way of making two programs communicate, without using sockets and whatnot
This is a simple showcase of how to make two different programs communicate in pure C without using sockets.
This is done using shared memory segments accessed using a unique key shared between two programs. No other program has access to this shared memory segment.
You can think of it as an arena allocated space for TWO programs at once! Isn't that cool???
Now, here are some concerns addressed:
- Is this secure? Not in the slightest!
- Is this fun to play with? Heck yeah!!
To build this example, run this command:
$ cc -o secwin second.c && cc -o mainwin main.c
@alexlnkp
alexlnkp / arch-installation-general-overview.md
Created October 17, 2024 05:22
General overview of steps that are necessary to install Arch linux

Disclaimer

This is NOT an installation guide/tutorial. This is only a general overview on what is GENERALLY done during Arch linux installation.

You still need to read the wiki to properly install Arch, what is written below is just an explanation on what is done, in what order and why.

Absolutely necessary steps are highlighted in bold.


Preparation

@alexlnkp
alexlnkp / pi_estimate.c
Created October 8, 2024 03:35
Pi estimation using only uniformally random numbers
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
double random_uniform(void) { return (double)rand() / (double)RAND_MAX; }
long double estimate_pi(int iter) {
int num_points_in_circle = 0, num_points_total = 0;
@alexlnkp
alexlnkp / 0001-fix-cstdint-not-found-error-in-C-API.patch
Created August 17, 2024 22:28
small patch for ImGuiFileDialog to build with cimgui
From 3d44b9f4a4f4adf5cc798b12663f800b6dcd3ac7 Mon Sep 17 00:00:00 2001
From: Alex Murkoff <[email protected]>
Date: Sun, 18 Aug 2024 05:23:48 +0700
Subject: [PATCH] fix cstdint not found error in C API
---
ImGuiFileDialog.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ImGuiFileDialog.h b/ImGuiFileDialog.h
@alexlnkp
alexlnkp / 0001-build-with-ImGuiFileDialog.patch
Created August 17, 2024 22:28
small patch for cimgui to build it with ImGuiFileDialog support
From 669232458c328f773b5dc0c8cdc3f77d0a9bb0b1 Mon Sep 17 00:00:00 2001
From: Alex Murkoff <[email protected]>
Date: Thu, 15 Aug 2024 06:57:50 +0700
Subject: [PATCH] build with ImGuiFileDialog
---
CMakeLists.txt | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@alexlnkp
alexlnkp / ampm.c
Created August 16, 2024 18:43
Compact storage of time using bitwise operations
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef short unsigned int tt;
typedef unsigned char byte;
tt TimeToTT(char *time_string) { /* example input: "12:24AM" */
char *hour_string = strtok(time_string, ":"); byte hours = atoi(hour_string);
@alexlnkp
alexlnkp / fftp.py
Last active June 26, 2024 23:46
Explaining F0 computation
import numpy as np
from matplotlib import pyplot as plt
from scipy.fft import fft, fftfreq
import scipy.io.wavfile as wav
import json
NOTES_MAP = json.load(open("notes_map.json", "r"))
WAVE_LOCATION = "rd.wav"
DURATION = 5 # Seconds
@alexlnkp
alexlnkp / qlock.c
Last active July 5, 2024 21:17 — forked from rexim/qlock.c
A forked qlock.c using linker embedding for the source code
/**********************ld -r -b binary -o qlock.o qlock.c*********************/
/*****************cc -w -include time.h -o out qlock.c qlock.o****************/
extern char _binary_qlock_c_start[];x,y,d[8],i,dx;f[]={31599,19812,14479,31207,\
23524,29411,29679,30866,31727,31719,1040};char*so,*si;p(ch){i=x/2/(3+1);dx=x/2\
%(3+1);if(i<8&&(y-1)/2<5&&dx<3&&(f[d[i]]>>((5-(y-1)/2-1)*3+dx))&1)printf(/****/
"\033[1;41;30m%c\033[0m",ch);else putchar(ch);if(ch=='\n'){y+=1;x=0;}else/****/
x+=1;}gd(){time_t t=time(NULL);struct tm*tm=localtime(&t);d[0]=tm->tm_hour/10;\
d[1]=tm->tm_hour%10;d[2]=10;d[3]=tm->tm_min/10;d[4]=tm->tm_min%10;d[5]=10;d[6]\
=tm->tm_sec/10;d[7]=tm->tm_sec%10;}main(){for(gd();;printf("\n\033[%dA\033[%dD"
,y+1,x),sleep(1),gd())for(so=_binary_main_c_start,x=0,y=0;*so;so++)p(*so);}/***
@alexlnkp
alexlnkp / autobuild
Created June 21, 2024 00:54
Simple quine program in C using just the linker
#!/bin/bash
gcc -std=c17 -o main.o -c main.c
ld -r -b binary -o main.c.o main.c
gcc -o out main.o main.c.o
rm main.o
rm main.c.o