Skip to content

Instantly share code, notes, and snippets.

View jacobsebek's full-sized avatar

Jakub Šebek jacobsebek

View GitHub Profile
@jacobsebek
jacobsebek / ukreport.tcl
Last active August 29, 2022 18:50
Command line Czech news feed about the war in Ukraine (Deprecated)
#!/usr/bin/env tclsh
# !! DEPRECATED !! THE NEWS ENDPOINT USED BY THIS SCRIPT HAS BEEN CLOSED !!
# Keep up with breaking news about Ukraine on the command line
# This Tcl script reports summaries of the most important events that
# took place since you last checked, scraped right from novinky.cz
# Dependencies: Tcl, curl
# Run with --raw, -r for a more parser-friendly format
# Run with --all, -a to list all the available news
@jacobsebek
jacobsebek / remcomment.c
Last active February 6, 2022 16:47
C/C++ comment remover
// Jakub Sebek, Feb 2022, Public Domain
// Please report bugs
#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
int main() {
bool stresc = false, rawstring = false, multil = false;
char strend = false, rawend[16+2] = ")", *rawdc = NULL;
@jacobsebek
jacobsebek / slineq.c
Last active June 13, 2021 22:51
A solver for arbitrary systems of linear equations
/*
14. 6. 2021
This piece of C99 code is a set of rudimentary functions for manipulating
linear functions of an aribtrary number of coefficients. This includes
a function for solving systems of an arbitrary amount of equations using
the substitution method.
Note that I aimed for the absolute best elegance of the code rather
than performance, which would require additional "if" checks, function
@jacobsebek
jacobsebek / tone_gen.c
Last active January 5, 2024 20:14
SDL2 tone generator
#include <SDL.h> // The SDL library
#include <math.h> // sin, fmod
#include <stdio.h> // printf
#define BUFFER_DURATION 1 // Length of the buffer in seconds
#define FREQUENCY 48000 // Samples per second
#define BUFFER_LEN (BUFFER_DURATION*FREQUENCY) // Samples in the buffer
void play_buffer(void*, unsigned char*, int);