awk '!/^([[:space:]]*#.*)?$/' testfile
testfile
:
Beginning line
Line starts with spaces
# Comment line
# Comment line starts with spaces
-- git clone https://github.com/amekusa/humb.lua.git humb | |
local humb = require('humb') | |
local test = humb:new_test({ | |
rpt = 1000, | |
digits = 4, | |
}) | |
do | |
local os_execute = os.execute |
-- A neovim function that smartly indents the current line | |
-- By github.com/amekusa | |
-- Tested with neovim v0.10 | |
-- | |
-- # What it does | |
-- If the current line is empty, | |
-- copies the indentations of the previous or the next line. (The longer one is chosen) | |
-- | |
-- If the current line is not empty, | |
-- simpy shift it to right. |
/* #ui */ | |
.HM .LH { | |
/* hint box background */ | |
background-color: #333d; | |
background-image: none; | |
/* hint box */ | |
border: 1px solid DarkTurquoise; | |
border-radius: 4px; | |
box-shadow: -1px 2px 2px #0008; |
:root { | |
--tridactyl-hintspan-bg: #333d !important; | |
--tridactyl-hintspan-font-family: "Georgia", monospace !important; | |
--tridactyl-hintspan-font-size: 13px !important; | |
--tridactyl-hintspan-font-weight: normal !important; | |
--tridactyl-hintspan-border-width: 1px !important; | |
--tridactyl-hintspan-border-style: solid !important; | |
} | |
span.TridactylHint { |
awk '!/^([[:space:]]*#.*)?$/' testfile
testfile
:
Beginning line
Line starts with spaces
# Comment line
# Comment line starts with spaces
div > .vimiumHintMarker { | |
/* linkhint boxes */ | |
background: #333d; | |
border: 1px solid DarkTurquoise; | |
border-radius: 4px; | |
box-shadow: -1px 2px 2px #0008; | |
} | |
div > .vimiumHintMarker span { | |
/* linkhint text */ |
/** | |
* Converts non-safe chars into HTML entities. | |
* @author amekusa | |
*/ | |
function escape(str) { | |
if (!str) return ''; | |
let map = { | |
'&': 'amp', | |
'"': 'quot', | |
"'": 'apos', |
/** | |
* Merges the 2nd object into the 1st object recursively (deep-merge). The 1st object will be modified. | |
* @param {object} x - The 1st object | |
* @param {object} y - The 2nd object | |
* @param {number} recurse=8 - Recurstion limit. Negative number means unlimited | |
* @return {object} The 1st object | |
* @author amekusa | |
*/ | |
function merge(x, y, recurse = 8) { | |
if (recurse && x && y && typeof x == 'object' && typeof y == 'object' && !Array.isArray(x) && !Array.isArray(y)) { |
if ! command -v realpath &> /dev/null; then | |
realpath() { | |
case "$1" in | |
/*) echo "$1" ;; | |
~/*) echo "$HOME/${1:2}" ;; | |
./*) echo "$PWD/${1:2}" ;; | |
~) echo "$HOME" ;; | |
.) echo "$PWD" ;; | |
*) echo "$PWD/$1" ;; | |
esac |
arr=( | |
name="John Doe" | |
age=32 | |
job="Software Engineer" | |
) | |
for each in "${arr[@]}"; do | |
key="${each%%=*}" | |
val="${each:$((${#key}+1))}" | |
echo "$key: $val" |