This file contains 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
/* | |
* perlin.c - create an image of Perlin (gradient) noise | |
* | |
* Compilling: | |
* gcc perlin.c -std=c99 -O3 -Wall -Wextra -Werror -fopenmp -lgomp | |
* | |
* Doc: | |
* ./a.out --help | |
* | |
* Thanks to: |
This file contains 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
/* A simple logging macro and some wrappers */ | |
#pragma once | |
/* | |
* The following requirements are for the "DEBUG" mode, which flushes | |
* everything to disk after each msg and syncs. If you do not wish this | |
* behaviour, which will incur in significant performance loss for "DEBUG" | |
* mode, remove these guards and edit the LOGGING macro, removing the fflush | |
* and fsync calls. |
This file contains 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 | |
# | |
# mplayerp - Use mplayer+bash as a full-featured music player | |
# | |
# Starts mplayer in slave mode listening to commands from a fifo and reading | |
# media from a playlist file. There are some extras to make it pleasent to use. | |
# | |
# Syntax: mplayerp [OPTIONS] [ACTION | DIR] | |
# | |
# Options: |
This file contains 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 | |
# Simple offline client for tldr pages | |
# | |
# Usage: | |
# tldr command | |
# | |
# Updating offline page cache: | |
# tldr --update | |
pf=${HOME}/.cache/tldr/pages |
This file contains 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
/* | |
* Don't repeat yourself - Go-like parameters for C | |
* | |
* Before DRY: | |
* | |
* foo(int i, double x, double y, struct planet const *p1, struct planet const | |
* *p2, struct planet const *p3, int j) | |
* | |
* After DRY: | |
* |
This file contains 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
CC=gcc | |
STD=-std=c99 | |
WARN=-Wall -Wextra -Wpedantic -Wformat-security -Wfloat-equal -Wshadow\ | |
-Wconversion -Winline -Wpadded | |
OPT=-O2 -march=native -ffinite-math-only -fno-signed-zeros | |
DBG=-O0 -g -ggdb | |
EXTRA= | |
LINK= | |
FLAGS=$(STD) $(WARN) $(OPT) $(EXTRA) $(LINK) |
This file contains 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
/* | |
* ./this width height topRGB bottomRGB | |
* ./this 400 400 FFFF00 000000 | feh - | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
int | |
main(int argc, char **argv) | |
{ |
This file contains 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
/* | |
* ./this width height topRGB bottomRGB [circleSizeDivFactor=4] | |
* ./this 800 600 FFFFFF 000000 | feh - | |
*/ | |
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define PRINT(c) do { printf("%d %d %d ", c >> 16, c >> 8 & 0xFF, c & 0xFF); } while(0) | |
#define IN_CIRCLE(x, y) ((i - y) * (i - y) + (j - x) * (j - x) <= r*r) |
This file contains 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 <stdio.h> | |
#include <assert.h> | |
#include <math.h> | |
#include <stdbool.h> | |
#define N 4 | |
static bool | |
double_equal(double a, double b, double epsilon) | |
{ |