Skip to content

Instantly share code, notes, and snippets.

View dhhdev's full-sized avatar

Daniel Hyldebrandt Hemmingsen dhhdev

View GitHub Profile
@dhhdev
dhhdev / fibonacci.c
Last active December 4, 2017 22:16
Fibonacci sequence between start and end term.
/*
* Fibonacci squence between start and end term.
*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int a = 0;
@dhhdev
dhhdev / wam.c
Last active December 18, 2017 08:19
Calculating moment, using (Q) kg * (D) m = (M) kgm.
#include <stdio.h>
#include <stdlib.h>
typedef enum {FALSE, TRUE} BOOLEAN;
void usage(char *program)
{
printf("Usage:\n");
printf("\tExample: %s 0 50 0.6\n\n", program);
printf("First argument is moment. (kgm)\n");
@dhhdev
dhhdev / dst.c
Created January 22, 2018 21:53
Distance, speed, and time calculator. Measure time taken with certain distance and speed, or get the speed needed to travel a certain distance within a certain time.
#include <stdio.h>
#include <stdlib.h>
#define PROGRAM_NAME "dst"
#define AUTHOR "Daniel H. Hemmingsen"
typedef enum {FALSE, TRUE} BOOLEAN;
/*
* distance = speed * time
@dhhdev
dhhdev / flatpak.zsh
Last active April 4, 2020 23:46
A collection of custom scripts mainly for sourcing, setting PATH etc.
# Making aliases for CLI to run flatpak sandboxes.
# I use zsh, but should be useable in bash as well.
# Requires find, basename
FLATPAK_ALIAS_PREFIX="fp"
FLATPAK_EXPORTS_PATH="/var/lib/flatpak/exports/bin"
FLATPAK_LIST=($(find $FLATPAK_EXPORTS_PATH -type l))
for FLATPAK_EXEC in "${FLATPAK_LIST[@]}"