Skip to content

Instantly share code, notes, and snippets.

View jdarge's full-sized avatar
🤓

Jan D. jdarge

🤓
View GitHub Profile
#define ERROR \
do {\
fprintf(stderr, "\nERROR: \nFile: \"%s\" \nFunction: \"%s()\" \nLine: \"%i\"\n\n", \
__FILE__, __func__, __LINE__);\
raise(SIGSEGV);\
} while(0)
/*
taken from:
MOC (music on console), alsa.c
*/
static snd_pcm_hw_params_t *alsa_open_device (const char *device)
{
int rc;
snd_pcm_hw_params_t *result;
assert (!handle);
SRC_DIR := src
INC_DIR := include
OBJ_DIR := obj
BIN_DIR := bin
EXE := $(BIN_DIR)/aes
SRC := $(wildcard $(SRC_DIR)/*.c)
OBJ := $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
char* readFile(char* input) {
FILE* input_file = fopen(input, "r");
if(!input_file) return NULL;
// CPP program to illustrate (##) operator
#include <stdio.h>
#define concat(a, b) a##b
int main(void)
{
int xy = 30;
printf("%d", concat(x, y));
return 0;
}
echo "" | gcc -E -dM -xc -

example:

echo "" | gcc -E -dM -xc - | grep SIZEOF
@jdarge
jdarge / gist:38fe4594986579224a03529066547502
Created October 22, 2023 14:55
Fish Shell pkg-config workaround...
gcc -o run main.c $(pkg-config --cflags --libs gtk4 | perl -pe 's/\s+/\n/g')