Skip to content

Instantly share code, notes, and snippets.

View qtaped's full-sized avatar
💾

Qntn qtaped

💾
View GitHub Profile
@qtaped
qtaped / regNumber.js
Created January 9, 2024 21:50
regular expression used to insert a certain character (like a comma) at every group of three digits in a number
// reg: /\B(?=(\d{3})+(?!\d))/g
let number = "1234567890";
let formattedNumber = number.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
console.log(formattedNumber);
// return 1 234 567 890
// "/": Delimiters used to indicate the beginning and end of the regular expression.
@qtaped
qtaped / syncFolders.sh
Last active January 12, 2023 22:04
simple rsync bash script
#!/usr/bin/env bash
# brew install rsync
# SETTINGS
def_src="$HOME" # default source
def_dst="/Path/to/external/drive/folder" # default destination
@qtaped
qtaped / backup-tm.sh
Last active January 9, 2024 21:53
backup-tm
#!/bin/sh
# rsync Apple TimeMachine-like backup script by Q.
# thanks to:
# http://habrahabr.ru/post/149059/
# http://www.jan-muennich.de/linux-backups-time-machine-rsyn
#uncomment to use notification
#export DISPLAY=:0
#export XAUTHORITY=/home/qntn/.Xauthority
#export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus