Skip to content

Instantly share code, notes, and snippets.

View arkon108's full-sized avatar
🎵

Saša Tomislav Mataić arkon108

🎵
View GitHub Profile
@arkon108
arkon108 / git-delete-local-branches-which-were-merged.sh
Created June 18, 2024 07:40
Git remove local branches which were merged
function git-prune-branches() {
echo "switching to master or main branch.."
git branch | grep 'main\|master' | xargs -n 1 git checkout
echo "fetching with -p option...";
git fetch -p;
echo "running pruning of local branches"
git branch -vv | grep ': gone]'| grep -v "\*" | awk '{ print $1; }' | xargs -r git branch -d ;
}
@arkon108
arkon108 / update-python-dependencies.sh
Last active June 18, 2024 07:23
Update Python dependencies
# when requirements.txt is updated
pip install -r requirements.txt
@arkon108
arkon108 / reclaim-sd-card-space.sh
Created December 1, 2023 10:49
Reclaim Full Storage Space on SD card on a Mac
# when a bootable SD card is created, the non-used space is converted to hidden partition
# step 0
# connect SD card and open terminal
# step 1
diskutil list
# step 2 find your sd card (e.g. /dev/disk4)
# step 3 erase the disk
@arkon108
arkon108 / auto-download-mp4-video.js
Created June 12, 2022 08:53
Automatically download source of the first video tag in page (e.g. from 9GAG)
let a = document.createElement("a");
a.href = window.URL.createObjectURL(new Blob([document.querySelectorAll("video:first-child source[type='video/mp4'")[0].src], {type: "video/mp4"}));
a.download = document.querySelectorAll('.main-wrap header h1')[0].textContent;;
a.click();
// find the first video tag, select the src attr in the source tag which matches "video/mp4"
const s = document.querySelectorAll("video:first-child source[type='video/mp4'");
window.location = s[0].src;

The minimal Node.js with Babel Setup

Nodemon

Once the project dir is created and initialized, install nodemon for development only

npm install nodemon --save-dev
@arkon108
arkon108 / .gitignore
Created January 25, 2022 15:43
Git track empty dir (e.g. uploads)
# Don't track files in this directory
*
# Don't track subdirs even
*/
# Except this file
!.gitignore
@arkon108
arkon108 / config-node-defaults
Created July 17, 2020 10:28
Configure Node project defaults
npm set init.author.name "STM"
npm set init.author.email "[email protected]"
npm set init.author.url "https://mataic.com"
npm set init.license "MIT"
npm set init.version "1.0.0"
@arkon108
arkon108 / start-node-project
Last active February 3, 2022 09:57
Start a node project (better npm init)
mkdir my_project
cd my_project
npx license mit > LICENSE
npx gitignore node
npx covgen [email protected]
npm init -y

Setting up Raspberry PI as a NAS

1. Install Raspbian

Once installed, connect online, open the terminal and run

sudo apt-get update && sudo apt-get upgrade