Skip to content

Instantly share code, notes, and snippets.

View Galadirith's full-sized avatar

Edward Fauchon-Jones Galadirith

View GitHub Profile
@mjackson
mjackson / color-conversion-algorithms.js
Last active June 8, 2024 01:27
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@PHLAK
PHLAK / ping-test.sh
Created February 11, 2014 18:11
24 hour while loop in bash
#!/bin/bash
## Script start time
START=$(date +%s)
## Total run time
DURRATION=$((60 * 60 * 24))
## Total running time
UPTIME=$(($(date +%s) - $START))
@mbauman
mbauman / MatlabClasses.ipynb
Last active April 23, 2023 14:33
Documenting how to parse Matlab's opaque class structure for MAT files with Julia.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mbreese
mbreese / docker-heredoc-snippet
Last active June 12, 2023 21:28
Running docker with a HEREDOC to script the commands to run inside the container.
docker run -v /Users/mbreese/tmp:/tmp1 -w /tmp1 -i centos:7 /bin/bash -s <<EOF
date > foo
echo 'foo' >> foo
cat /etc/redhat-release >> foo
whoami >> foo
EOF
@mfuerstenau
mfuerstenau / zigzag-encoding.README
Last active July 1, 2024 17:19
ZigZag encoding/decoding explained
ZigZag-Encoding
---------------
Maps negative values to positive values while going back and
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...)
(i >> bitlength-1) ^ (i << 1)
with "i" being the number to be encoded, "^" being
XOR-operation and ">>" would be arithemtic shifting-operation

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 8, 2024 04:38
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active June 29, 2024 15:54
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@hyper-neutrino
hyper-neutrino / english-words.txt
Created August 10, 2020 20:45
3000 common english words
a
abandon
ability
able
abortion
about
above
abroad
absence
absolute
@Makeshift
Makeshift / tutorial.md
Last active June 19, 2024 16:40
Tutorial for automatically syncing an Obsidian vault with Git on an Android device

How to sync Obsidian with Git on Android

Limitations

  • If Termux is closed in the background by Android, the cron service will stop updating your repository and you must open Termux again. Refer to instructions for your device model to disable the killing of certain background applications.
  • This may negatively affect your devices battery life. I'm not entirely sure yet.

Setup