Skip to content

Instantly share code, notes, and snippets.

View matthewhartman's full-sized avatar

Matthew Hartman matthewhartman

View GitHub Profile
@matthewhartman
matthewhartman / format-commas.js
Created January 13, 2021 06:36 — forked from patik/format-commas.js
Format number with commas
// Converts `1234567` => `"1,234,567"
// Does not support decimals yet
function formatNumberWithCommas (number) {
return ('' + number) // Convert to a string
.split('').reverse().join('') // Reverse the order of the characters (which are all digits at this point)
.replace(/(...)/g, '$1,') // Insert a comma after every three digits
.split('').reverse().join('') // Un-reverse the characters
.replace(/^,/, ''); // Remove any commas that were added to the beginning (i.e. if the number of digits was a multiple of three)
};
@matthewhartman
matthewhartman / install-latest-curl-on-linux.markdown
Last active May 18, 2021 01:26
Latest CURL on Debian Linux

Download CURL from the following

https://curl.se/download.html

tar xzvf curl-7.68.0.tar.gz
cd curl-7.68.0
./configure --with-ssl
make
sudo make install
@matthewhartman
matthewhartman / divider.js
Created October 8, 2020 05:37
Divider in JS
const divider = Array(20).join('-');
// output
// --------------------
@matthewhartman
matthewhartman / install-firefox-on-linux-debian.markdown
Created September 17, 2020 01:40
Install Firefox on Linux Debian

Install Firefox on Debian

Download firefox binary firefox-80.0.1.tar.bz2 and extract contents into /opt/ directory

sudo tar -xf firefox-*.tar.bz2 /opt/

Create symlink

@matthewhartman
matthewhartman / fix-crackling-for-pulseaudio-linux.markdown
Last active August 24, 2020 00:27
Fix Pulse Audio Crackling in Linux

Fix Pulse Audio Crackling in Linux

sudo nano /etc/pulse/default.pa

Find the following line:

load-module module-udev-detect

Running Docker on Ubuntu WSL

Configure Docker for Windows (Docker Desktop)

Windows Docker Settings

Install Docker in Ubuntu WSL

Update the apt package list

@matthewhartman
matthewhartman / install-yarn-linux-debian.markdown
Created August 5, 2020 23:25
Install Yarn on Linux (Debian)

Installing Yarn on Debian

Import the repository's GPG key

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

Enable the Yarn APT repository

@matthewhartman
matthewhartman / install-maven-linux-debian.markdown
Created July 28, 2020 02:55
Install Maven on Linux (Debian)
@matthewhartman
matthewhartman / install-java-jdk-linux-debian.markdown
Last active August 5, 2020 03:48
Install Java JDK on Linux Debian

Install Java JDK On Linux (Debian)

First install the directory where the JDK binary will live

sudo mkdir -p /usr/lib/jvm

Download and extract binary (use login)