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
#!/usr/bin/env kotlin | |
@file:DependsOn("io.ktor:ktor-client-core-jvm:1.5.3") | |
@file:DependsOn("io.ktor:ktor-client-cio-jvm:1.5.3") | |
@file:DependsOn("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1") | |
@file:DependsOn("org.json:json:20220320") | |
import kotlinx.coroutines.* | |
import io.ktor.client.* | |
import io.ktor.client.request.* |
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 java.lang.IllegalArgumentException | |
import kotlin.math.floor | |
import kotlin.math.roundToInt | |
/** | |
* Pass a hue value/degree between 0 and 360 or pass nothing and generate a random value. Returns a random flat color as hex string. | |
*/ | |
fun flatColor(deg: Float? = null): String { | |
val h = if (deg == null) { | |
val phi = 0.618033988749895 |
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
find . -mindepth 2 -type f -print -exec mv {} . \; |
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 | |
DATABASE="/home/simon/Dev/projects/LinuxCommandBibliotheca/app/src/main/assets/databases/commands.db" | |
id=10 | |
manpage="$(sqlite3 $DATABASE "SELECT manpage FROM commands WHERE _id=$id")" | |
title="$(sqlite3 $DATABASE "SELECT name FROM commands WHERE _id=$id")" | |
category="$(sqlite3 $DATABASE "SELECT category FROM commands WHERE _id=$id")" | |
echo $manpage > $title"_"$category".html" |
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 | |
# $1 = command | |
# $2 = man page section | |
# $3 = special file extension | |
OUT_DIR="/home/simon/manpages" | |
special=${3-$2} | |
cd "/usr/share/man/man"$2 |
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 | |
OUT_DIR="/home/simon/manpages" | |
DATABASE="/home/simon/commands.db" | |
sqlite3 $DATABASE "PRAGMA encoding='UTF-8';" | |
sqlite3 $DATABASE "drop table if exists commands;" | |
sqlite3 $DATABASE "create table commands (_id integer primary key, category numeric, name text, description text, manpage text);" | |
path=( "man1" "man2" "man8" "man6" ) | |
categories=(1 2 8 6) |