Skip to content

Instantly share code, notes, and snippets.

View dade80vr's full-sized avatar
💭
Nightly Coder

Davide Permunian dade80vr

💭
Nightly Coder
View GitHub Profile
@dade80vr
dade80vr / brew-perm.sh
Last active September 4, 2017 15:25
Set Mac HomeBrew permission to current user
#!/bin/bash
sudo chown -R $(whoami) /usr/local
# Additionally, you could use (remove #)
# chgrp -R admin /usr/local
# chmod -R g+w /usr/local
# chgrp -R admin /Library/Caches/Homebrew
# chmod -R g+w /Library/Caches/Homebrew
# dseditgroup -o edit -a $USER -t user admin
@dade80vr
dade80vr / speedtest.sh
Created August 22, 2017 19:42
Speedtest-cli on Synology / Raspberry
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli
@dade80vr
dade80vr / vbox-readable.sh
Last active September 12, 2017 20:08
Set Virtualbox folder readable/writeable to all users in Mac or Linux
#!/bin/bash
sudo chmod -R 777 /VirtualBox\ VMs/
@dade80vr
dade80vr / shell-colours.sh
Created July 4, 2017 15:48
Bash shell colours. Use "source shell-colours.sh" in the head of your script and call colours with [ echo -e "${Blue}Blue text${Color_Off} Default text" ]
#!/bin/bash
# Reset
Color_Off='\033[0m' # Text Reset
# Regular Colors
Black='\033[0;30m' # Black
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Blue='\033[0;34m' # Blue
@dade80vr
dade80vr / .profile
Created June 12, 2017 15:50
Set Fish shell default into Synology NAS
preferred_shell=
if [ -x /opt/bin/fish ]; then
preferred_shell=/opt/bin/fish
fi
if [ -n "$preferred_shell" ]; then
case $- in
*i*) SHELL=$preferred_shell; export SHELL; exec "$preferred_shell";;
esac
fi
@dade80vr
dade80vr / encdec.sh
Created May 10, 2017 15:31
Encrypt/decrypt files with aes-256-cbc cipher using openssl (Mac/Linux)
#!/bin/bash
#encrypt files
if [ $1 == "-e" ];
then
if [ -f "$2" ];
then
openssl aes-256-cbc -a -e -salt -in "$2" -out "$2.aes"
else
echo "This file does not exist!"
fi
@dade80vr
dade80vr / darkstat-clean.sh
Last active October 25, 2018 16:55
Synology NAS script for cleaning Darkstat logs
#!/bin/bash
#stop Darkstat service
sudo synoservicecfg --stop pkgctl-darkstat
#removing logfile
sudo rm /var/packages/darkstat/target/var/darkstat.data
#restart Darkstat service
sudo synoservicecfg --start pkgctl-darkstat
@dade80vr
dade80vr / dotclean.sh
Last active May 11, 2021 20:52
Mac OSX Bash script for quick dot files cleaning on USB/SD and auto eject
#!/bin/bash
# DOT files clean script and auto eject
printf "Insert your USB/SD volume name (es: SD): "
read -r volumename
if df | grep -iw "$volumename" > /dev/null
then
echo "Cleaning dot_files into \"/Volumes/$volumename\" .."
sudo dot_clean /Volumes/$volumename
echo "Ejecting volume .."
sudo diskutil eject /Volumes/$volumename