Skip to content

Instantly share code, notes, and snippets.

View mattdanielbrown's full-sized avatar

Matt Daniel Brown mattdanielbrown

View GitHub Profile
  • SC1000 $ is not used specially and should therefore be escaped.
  • SC1001 This \o will be a regular 'o' in this context.
  • SC1003 Want to escape a single quote? echo 'This is how it'\''s done'.
  • SC1004 This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
  • SC1007 Remove space after = if trying to assign a value (or for empty string, use var='' ... ).
  • SC1008 This shebang was unrecognized. ShellCheck only supports sh/bash/dash/ksh. Add a 'shell' directive to specify.
  • SC1009 The mentioned parser error was in ...
  • SC1010 Use semicolo

A map of the sky that uses an azimuthal equidistant projection with star data. Longitudes and latitudes for the geo projection are obtained from declination and right ascension respectively (longitude is also inverted, because, unlike the earth globe, the celestial sphere is seen from the inside).

The boreal (northern) sky is shown at left, while the austral (southern) at right. Because right ascension is given in hours, both maps are divided in 24 slices. A circle is shown every 10 degrees of declination.

Star size indicates magnitude. Bigger circles depict brighter stars.

@mattdanielbrown
mattdanielbrown / gistcat
Created November 6, 2023 00:38 — forked from itayd/gistcat
cat a file from gist, search by username + filename
#!/bin/bash
notags() {
while read line; do
echo $line | sed -e "s/<[^>]*>/ /g" -e "s/ / /g"
done
}
user=$1
wanted=$2
@mattdanielbrown
mattdanielbrown / bash-colors.md
Created October 22, 2023 18:29 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@mattdanielbrown
mattdanielbrown / ANSI-color-codes.h
Created October 22, 2023 18:29 — forked from RabaDabaDoba/ANSI-color-codes.h
The entire table of ANSI color codes working in C!
/*
* This is free and unencumbered software released into the public domain.
*
* For more information, please refer to <https://unlicense.org>
*/
//Regular text
#define BLK "\e[0;30m"
#define RED "\e[0;31m"
#define GRN "\e[0;32m"
@mattdanielbrown
mattdanielbrown / gist
Created February 24, 2023 18:58 — forked from itayd/gist
bash gist cli
#!/bin/bash
require() {
for what in $*; do
if !(which $what >& /dev/null); then
echo "error: $what is required to run this script, please install it"
exit 1
fi
done
}

async / return await explained

This is yet another explanation of why async and return await is pointless, coming from this post.

// async means that this:
const fn = async (...args) => {/* stuff */};

// is basically the equivalent of this:
@mattdanielbrown
mattdanielbrown / attr.js
Created December 14, 2021 18:33 — forked from WebReflection/attr.js
A dataset like behavior for any attribute
const proxies = new WeakMap;
const hyphen = name => name.replace(/([a-z])([A-Z])/g, '$1-$2');
const handler = {
get: (el, name) => el.getAttribute(hyphen(name)),
set: (el, name, value) => {
el.setAttribute(hyphen(name), value);
return true;
}
};
const set = el => {
@mattdanielbrown
mattdanielbrown / marked-asciidoc-content.adoc
Created March 22, 2021 03:04 — forked from mojavelinux/marked-asciidoc-content.adoc
Advice on configuring Marked (OSX) to work with AsciiDoc content using AsciiDoc (or Asciidoctor) as a custom Markdown processor, including how to get AsciiDoc includes to work.

Using Marked with AsciiDoc content

Using Marked with AsciiDoc content

Marked is an OSX application to preview Markdown syntax in HTML. It’s possible to configure AsciiDoc as an custom Markdown processor to create the HTML for your AsciiDoc files.

@mattdanielbrown
mattdanielbrown / is_integer
Created March 10, 2021 15:10 — forked from earthgecko/is_integer
is_integer
function is_integer () {
# exit code 0 - the string is an integer
# exit code 1 - the string is not an integer
local string=$1
[[ $string == ${string//[^0-9]/} ]]
}