Skip to content

Instantly share code, notes, and snippets.

View mkyrychenko's full-sized avatar

Mykhailo Kyrychenko mkyrychenko

View GitHub Profile
@mkyrychenko
mkyrychenko / terminal-fonts.sh
Last active January 8, 2021 12:54
Colourized logger for shell scripts in the terminal (compatible with POSIX shell)
#!/usr/bin/env sh
# set term colors
# read more at:
# https://misc.flogisoft.com/bash/tip_colors_and_formatting
# http://ascii-table.com/ansi-escape-sequences-vt-100.php
#
# font attributes to use in the terminal with '\e[_%ATTR%_m' (_%ATTR%_ should be replaced with integer)
# e.g. $ echo -e "\e[3m test \e[0m"
# outputs string "test" in italic
@mkyrychenko
mkyrychenko / ip-calc.old.sh
Created June 10, 2021 22:01
Bash IP Calculator
#!/usr/bin/env bash
#1. if you have only network prefix available (no netmask)
IP=10.20.30.240
PREFIX=26
IFS=. read -r i1 i2 i3 i4 <<< $IP
IFS=. read -r xx m1 m2 m3 m4 <<< $(for a in $(seq 1 32); do if [ $(((a - 1) % 8)) -eq 0 ]; then echo -n .; fi; if [ $a -le $PREFIX ]; then echo -n 1; else echo -n 0; fi; done)
printf "%d.%d.%d.%d\n" "$((i1 & (2#$m1)))" "$((i2 & (2#$m2)))" "$((i3 & (2#$m3)))" "$((i4 & (2#$m4)))"
// see https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.QRious=e()}(this,function(){"use strict";function t(t,e){var n;return"function"==typeof Object.create?n=Object.create(t):(s.prototype=t,n=new s,s.prototype=null),e&&i(!0,n,e),n}function e(e,n,s,r){var o=this;return"string"!=typeof e&&(r=s,s=n,n=e,e=null),"function"!=typeof n&&(r=s,s=n,n=function(){return o.apply(this,arguments)}),i(!1,n,o,r),n.prototype=t(o.prototype,s),n.prototype.constructor=n,n.class_=e||o.class_,n.super_=o,n}function i(t,e,i){for(var n,s,a=0,h=(i=o.call(arguments,2)).length;a<h;a++){s=i[a];for(n in s)t&&!r.call(s,n)||(e[n]=s[n])}}function n(){}var s=function(){},r=Object.prototype.hasOwnProperty,o=Array.prototype.slice,a=e;n.class_="Nevis",n.super_=Object,n.extend=a;var h=n,f=h.extend(function(t,e,i){this.qrious=t,this.element=e,this.element.qrious=t,this.enabled=Boolean(i)},{draw:f