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 <gmp.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
/** | |
* Compute the factorial of `n` and store it in `f`. | |
*/ | |
void factorial(mpz_t f, mpz_t n) { | |
// f ← 1 | |
mpz_set_ui(f, 1); |
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 | |
# A simple pomodoro timer. Uses an interval of 25 minutes on, 5 minutes off by | |
# default, but is configurable using optional arguments. | |
# | |
# Usage: | |
# ./pomodoro.sh [on time] [off time] | |
# | |
# Example (using an interval of 30 min on, 10 min off): | |
# ./pomodoro.sh 30 10 |
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 collection of three macros for debugging: DEBUG, WARN, ERROR. | |
* | |
* All three take a variable number of arguments and match the format of the | |
* printf family of functions. For example: | |
* WARN("The value of n is %d\n", n); | |
* | |
* All three are disabled if NDEBUG is defined, just like assert. | |
* | |
* by Miles Glapa-Grossklag, 2021 |
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 | |
# Search recursively for all files with the extension of the first argument. | |
# Replace them with the extension of the second argument. | |
if [ "$#" -ne 2 ]; then | |
echo "Usage:" | |
echo " $0 <from> <to>" | |
exit 1 | |
fi |