Skip to content

Instantly share code, notes, and snippets.

View jurca's full-sized avatar

Martin Jurča jurca

View GitHub Profile
// zobrazení
display
// pozicování
float
position
left
right
top
bottom
@jurca
jurca / low-fi-image.js
Last active October 24, 2022 10:44
Low-bit-depth image convertor
/*
* Usage example:
* Open an image in a new tab, open the Dev tools, run the code in this gist using the console.
* After that, to create low-fi version of the opened image, run the following code:
*
* img = document.querySelector('img')
*
* document.body.append(createLoFiImage(img, [5, 6, 5])) // High color 16-bit
* document.body.append(createLoFiImage(img, [5, 5, 5])) // High color 15-bit
* document.body.append(createLoFiImage(img, [4, 4, 4])) // 12-bit
@jurca
jurca / update-flatpaks.sh
Last active November 21, 2022 08:58
Utility for updating flatpak apps on Ubuntu. GUI included.
#!/bin/sh
# Add this script to your "Startup apps" to run it every time you sign into your OS.
updates_available=$(flatpak update | grep --perl-regexp '^\s*\d+\.\s+' | wc -l)
if [ "$updates_available" = 0 ]
then
# This may be caused by a missing dependecy of a new version of an app to
# update, so we need to explicitly check for that.
@jurca
jurca / asciiGraphGenerator.js
Created January 27, 2023 09:16
Generator of ASCII-style column graphs
/**
* Generates an ASCII-style (using UTF-8 characters) column graph of the provided values.
*
* @param {number[]} data The values to graph as columns. Each value will be represented by a single column in the graph.
* @param {number} minY The lower bound of the Y axis.
* @param {number} maxY The upper bound of the Y axis.
* @param {number} scaleY The number of text rows to represent the Y axis.
* @return {string} Generated text-based column graph.
*/
function asciiGraph(data, minY, maxY, scaleY) {