Skip to content

Instantly share code, notes, and snippets.

View gko's full-sized avatar
🐑
📃💨

Konstantin gko

🐑
📃💨
View GitHub Profile
@gko
gko / fromhex.bash
Created March 20, 2020 10:45 — forked from mhulse/fromhex.bash
Bash function to convert hex to 256 terminal color.
# fromhex A52A2A
# fromhex "#A52A2A"
# BLUE_VIOLET=$(fromhex "#8A2BE2")
# http://unix.stackexchange.com/a/269085/67282
function fromhex() {
hex=$1
if [[ $hex == "#"* ]]; then
hex=$(echo $1 | awk '{print substr($0,2)}')
fi
r=$(printf '0x%0.2s' "$hex")
#!/bin/bash
# This script takes a remote repository and merges it into
# the current one as a subdirectory
set -e
if [ -z "$1" ]
then
echo "Usage:"