Skip to content

Instantly share code, notes, and snippets.

Avatar

Jakub Šebek jacobsebek

  • Czech Republic
View GitHub Profile
@jacobsebek
jacobsebek / ukreport.tcl
Last active May 7, 2022
Command line Czech news feed about the war in Ukraine
View ukreport.tcl
#!/usr/bin/env tclsh
# 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
# Run with --timef, -t [fmt] to specify time format (strftime)
@jacobsebek
jacobsebek / remcomment.c
Last active Feb 6, 2022
C/C++ comment remover
View remcomment.c
// 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 Jun 13, 2021
A solver for arbitrary systems of linear equations
View slineq.c
/*
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 Jan 17, 2022
SDL2 tone generator
View tone_gen.c
#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);