This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
# https://unix.stackexchange.com/questions/9496/looping-through-files-with-spaces-in-the-names | |
find . -type f -name '*.wav' -exec sh -c ' | |
for file do | |
echo "$file" | |
ffmpeg -i "$file" -acodec mp3 "${file%.*}.mp3" | |
done | |
' exec-sh {} + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stddef.h> | |
#include <stdio.h> | |
/* Base power of 2 to decimal */ | |
static unsigned bpt2dec(unsigned x, size_t mask) { | |
int indec = 0; | |
const int bits = __builtin_popcount(mask); | |
for (int i = 0; x != 0; ++i, x >>= bits) | |
indec += ((x & mask) << (i * bits)); | |
return indec; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{tikzpicture} | |
\coordinate (center) at (0, 0); | |
\def\radius{2cm} | |
\def\n{5} | |
\pgfmathsetmacro\angle{360/\n} | |
\pgfmathsetmacro\startangle{90} | |
\foreach \i in {0,...,4} { | |
\coordinate (point\i) at ({\startangle+\angle*\i}:\radius); | |
\coordinate (label\i) at ({\startangle+\angle*\i}:\radius+0.25cm); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
/// Valid syntax for whatever reason :D. | |
/// See https://www.youtube.com/watch?v=YlmxNJnone0 for details (if you dare). | |
/// | |
int main() { | |
auto l = [][[]]([[]] auto) [[]] { return 42; }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <functional> | |
#include <concepts> | |
// Problem: Pass a function as an argument | |
// 1. function pointer (old & C-style) | |
// Ugly but somewhat nice as it is very simple. See https://cdecl.org | |
// BTW: https://www.youtube.com/watch?v=6eX9gPithBo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MIT License, Kristiyan Stoimenov 2023 | |
# | |
# Use `--help` for a nice overview of the options. | |
import PyPDF2 | |
import argparse | |
argparser = argparse.ArgumentParser() | |
argparser.add_argument("-o", "--output_file", help="output file") | |
argparser.add_argument("-i", "--input_file", help="input file") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compiler explorer: https://godbolt.org/z/dnjeMhzv1 | |
#include <stdio.h> | |
void array_index() { | |
int x = 3; | |
int a[5]; | |
a[x] = 0; | |
if (x >= 5) | |
printf("Hello world\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
project_name="project_name" | |
out_dir=build/out | |
usage() { | |
echo "Bad usage: ./build/abc.sh [build|test|clean|format]" | |
} | |
make_build() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
from glob import glob | |
from argparse import ArgumentParser | |
from colorama import Fore, Style | |
extension='jpg' | |
path='./' | |
out=f'{path}/slides.pdf' | |
parser = ArgumentParser(description='Convert multiple images to a pdf') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.19) # Lower versions should also be supported | |
project(cpp20-modules) | |
# Add target to build iostream module | |
add_custom_target(std_modules ALL | |
COMMAND ${CMAKE_COMMAND} -E echo "Building standard library modules" | |
COMMAND g++ -fmodules-ts -std=c++20 -c -x c++-system-header iostream | |
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
) |
NewerOlder