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 / 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
Created June 22, 2024 02:35 — 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_main_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
@alexlnkp
alexlnkp / rlnk.c
Created June 19, 2024 19:50
Simple raylib demo with raylib-nuklear
#include <stdlib.h>
#include <stdint.h>
#include <raylib.h>
#include <raymath.h>
#include <rcamera.h>
#include <math.h>
#define RAYLIB_NUKLEAR_IMPLEMENTATION
@alexlnkp
alexlnkp / task.md
Last active June 15, 2024 17:39
random problem i came up with (solution in comments)

Custom Bitwise Sequence Finder

Write a program that accepts two unsigned 32-bit integers, start and end. Your program should calculate a sequence of specific bitwise operations that, when applied to start, result in end.

The available operations and their constraints

  • Left shift (<<): Shift the current value one bit to the left.
  • Bitwise AND (&): Perform the bitwise AND of the current value and end.
  • Custom bitwise OR (|): Perform the bitwise OR of the current value and the number 2.
  • Custom bitwise XOR (^): Perform the bitwise XOR of the current value and the result of end % <CURRENT_VALUE>.
  • Bitwise NOT (~): Perform the bitwise NOT of the current value.
@alexlnkp
alexlnkp / ff-info.sh
Created May 9, 2024 15:16
bash script to parse font-family values of fontfiles
#!/bin/bash
set -e +x
# Quick bash script to grab font-family value of any `.ttf`, `.otf` and `.woff` fonts.
# Usage: ./ff-info.sh <PATH>
# Where <PATH> is the path to the font.
OUTPUT=`fc-scan $1 | grep family:`
# If multiple font-families are printed out - don't worry!
@alexlnkp
alexlnkp / q.css
Created May 5, 2024 03:25
qcss custom local font
:root {
--Font-Used: 'CaskaydiaCove Nerd Font Mono', semibold;
--Font-Size: 5px ;
--Font-Style: normal ;
--Font-Weight: semibold ;
@alexlnkp
alexlnkp / gist:640175854344ab8402164431e0b249fc
Created May 4, 2024 12:45
Steam Runtime Diagnostics run of 2024.05.04
"LD_* scout runtime" information:
{
"steam-runtime-system-info" : {
"version" : "0.20240301.0+srt1",
"path" : "/home/alex/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/bin/steam-runtime-system-info"
},
"can-write-uinput" : true,
"steam-installation" : {
"path" : "/home/alex/.local/share/Steam",
"data_path" : "/home/alex/.local/share/Steam",