The attached script provides a function for comparing semantic versions in a POSIX shell script.
Result | Description |
---|---|
-1 |
A<B |
0 |
A=B |
1 |
A>B |
#!/usr/bin/env bash | |
# | |
# https://gist.github.com/joehillen/30f08738c1c3c0ca3e4c754ad33ad2ff | |
# | |
# This script inlines 'source' files. | |
# | |
# For long scripts, it is nice to be able to break them into multiple files | |
# to make them easier to work with but still release as a single script. | |
# | |
# Inspired by https://stackoverflow.com/a/37533160/334632 with the following enhancements: |
Time | Total | Today | Power | Voltage | Current | |
---|---|---|---|---|---|---|
2022-07-24T15:03:02 | 0.037 | 0.037 | 40 | 227 | 0.282 | |
2022-07-24T15:03:07 | 0.037 | 0.037 | 39 | 227 | 0.282 | |
2022-07-24T15:03:12 | 0.037 | 0.037 | 38 | 227 | 0.283 |
# | |
# CMake build system for Dear ImGui | |
# ================================= | |
# | |
# Build instructions: | |
# 1. Install latest CMake | |
# * Windows: https://cmake.org/download/ (Tick checkbox to place cmake in system PATH) | |
# * Linux: from your favorite package manager | |
# * MacOS: brew install cmake | |
# 2. Open command prompt in directory containing "imgui" and "imgui_dev" folders |
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '" | |
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'; | |
if( $found ){ | |
$remoteport = $matches[0]; | |
} else{ | |
echo "The Script Exited, the ip address of WSL 2 cannot be found"; | |
exit; | |
} |
\documentclass{article} | |
\usepackage[dvipsnames]{xcolor} % https://en.wikibooks.org/wiki/LaTeX/Colors | |
\definecolor{LightGray}{rgb}{0.97,0.97,0.97} | |
\usepackage{listings} % syntax highlighting | |
\lstdefinelanguage{SPARQL}{ | |
basicstyle=\small\ttfamily, | |
backgroundcolor=\color{LightGray}, | |
columns=fullflexible, | |
breaklines=false, |
#!/sbin/openrc-run | |
description="node_exporter" | |
: ${NODE_PIDFILE:=/var/run/node_exporter.pid} | |
: ${NODE_USER:=root} | |
depend() { | |
need net | |
need localmount |
#!/bin/bash | |
version="${VERSION:-1.0.1}" | |
arch="${ARCH:-linux-amd64}" | |
bin_dir="${BIN_DIR:-/usr/local/bin}" | |
wget "https://github.com/prometheus/node_exporter/releases/download/v$version/node_exporter-$version.$arch.tar.gz" \ | |
-O /tmp/node_exporter.tar.gz | |
mkdir -p /tmp/node_exporter |
This is a guide for aligning images.
See the full Advanced Markdown doc for more tips and tricks
get_latest_release() { | |
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | |
grep '"tag_name":' | # Get tag line | |
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value | |
} | |
# Usage | |
# $ get_latest_release "creationix/nvm" | |
# v0.31.4 |