Skip to content

Instantly share code, notes, and snippets.

View SimonSchubert's full-sized avatar

Simon Schubert SimonSchubert

View GitHub Profile
@SimonSchubert
SimonSchubert / Blood Moon - Luna
Last active May 16, 2022 09:52
Monitor LUNA and UST market cap and estimate when selling pressure will end
#!/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.*
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
find . -mindepth 2 -type f -print -exec mv {} . \;
@SimonSchubert
SimonSchubert / gist:7db4209ebac7ffded840
Created October 31, 2015 01:42
Create linux man page html file
#!/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"
#!/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
@SimonSchubert
SimonSchubert / gist:6f0715610cb37f4fda12
Last active February 25, 2017 17:47
Loop linux man pages and save to SQLite
#!/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)