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
.PHONY: test | |
test: main | |
./$< | |
main: main.o incl_hello.o incl_message.o | |
main.o: main.c include_file.h | |
incl_%.o: incl_%.txt | |
@# If you always want to use includes as strings, you can check that | |
@# they are null-terminated at compile-time: |
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 | |
# Usage: | |
# trim FILE START END FADE_IN FADE_OUT | |
# 1 2 3 4 5 | |
# Trim the file between START and END, with fade in and out, and | |
# 2 seconds of silence after | |
dur=`expr "${3%:*}" \* 60 + "${3#*:}" - "${2%:*}" \* 60 - "${2#*:}"` | |
fo=`expr "$dur" - $5` |
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 | |
vet() { | |
echo "Playing $1" | |
mpv --no-audio-display "$1" | |
read x | |
if [ "$x" == "y" ]; then | |
cp -v "$1" "$2/" | |
else | |
echo "Skipping $1" | |
fi |
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> | |
static const char *closebuff[1024]; | |
static const char tabs[] = "\t\t\t\t\t\t\t\t"; | |
void | |
put(int *t, const char *msg) | |
{ | |
const char *indent = tabs + sizeof(tabs) - 1 - *t; | |
printf("%s%s\n", indent < tabs ? tabs : indent, msg); |
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 <stdint.h> | |
int | |
main(void) | |
{ | |
int c, d; | |
while ((c = getchar()) != EOF) { | |
d = c & 0x1f; | |
if ((c | 0x20) > 0x60 && d < 26) { |
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
.PHONY: default | |
default: spectrum.png | |
.PHONY: waves-video | |
waves-video: waves | |
./$< | mpv --no-correct-pts --fps=30 --scale=oversample - | |
.PHONY: test test-video | |
test: nz.png | |
sxiv $^ |
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
/* | |
* Idea: We want to cycle through all hues, with maximum saturation and value, | |
* using RGB. This gives 1530 = 3! * (256 - 3!) colours: | |
000-0fe: ff 00-fe 00 | |
0ff-1fd: ff-01 ff 00 | |
1fe-2fc: 00 ff 00-fe | |
2fd-3fb: 00 ff-01 ff | |
3fc-4fa: 00-fe 00 ff | |
4fb-5f9: ff 00 ff-01 |
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
import io | |
import sys | |
class wrap_stdio: | |
def __init__(self, io_in = ''): | |
self.io_in = io.StringIO(io_in) | |
self.io_out = io.StringIO() | |
self.stdin = sys.stdin | |
self.stdout = sys.stdout |
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
/* Idea: | |
* Use 8 spaces for indenting the body of clauses | |
* Use 4 spaces for all other indentation | |
* Set your editor to expand tab to 4 spaces | |
This is highly readible while minimising effort while writing. | |
Indentation that requires manual character-level alignment would be | |
extremely painful (for me). | |
*/ | |
with |
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
*.o | |
*.o | |
primes.*.so |