Skip to content

Instantly share code, notes, and snippets.

View kusalananda's full-sized avatar
🖥️
Improving

Andreas Kähäri kusalananda

🖥️
Improving
View GitHub Profile
@kusalananda
kusalananda / UL-canonical-questions.txt
Last active September 13, 2019 21:35
A list of links to the Unix & Linux StackExchange site for common questions that I often refer to (and other things), organised by topic.
"Thank you" answers:
Rather than adding a separate "Thank you", upvote the answer(s) that helped you, and consider ["accepting" the answer](https://unix.stackexchange.com/help/someone-answers) that was the most helpful in resolving your issue. These are the best ways of showing gratitude on this site. Accepting an answer not only marks the question as resolved, but also signals to _future readers_ that the accepted answer actually solved the issue. More information about this is available here: https://unix.stackexchange.com/help/someone-answers
"Thank you" comments (should have been an accepted answer):
Good! If this solves your issue, please consider ["accepting" the answer](https://unix.stackexchange.com/help/someone-answers). This is the best way to show gratitude on this site. Accepting an answer not only marks the question as resolved, but also signals to _future readers_ that the accepted answer actually solved the issue. More information about this is available here: https://unix.stackexchange.c
@kusalananda
kusalananda / fizzbuzz.c
Last active August 18, 2017 10:32
The FizzBuzz "game" in C with input validation and ability to easily extend to more numbers/words
/* See Tom Scott's YouTube video "FizzBuzz: One Simple Interview Question"
* https://youtu.be/QPZ0pIK_wsc
*/
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char **argv)
@kusalananda
kusalananda / shtest.fun
Last active February 24, 2017 15:14
Shell function that test a command in all installed shells and captures+displays the output. Should work with both ksh93 and bash.
function shtest
{
# Will run the given command in all avaliable shells and capture and
# display the output generated on standard output as well as any
# diagnostic messages generated on standard error, together with the
# exit code.
grep '^[^#]' /etc/shells | (
typeset -a tmpfiles
trap 'rm -f "${tmpfiles[@]}"' EXIT