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 / wpa_supplicant.conf
Created August 29, 2019 22:03
wpa_supplicant.conf example file for Raspberry Raspbian Buster and older
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="<your_wifi_SSID>"
psk="<your_wifi_password>"
key_mgmt=WPA-PSK
}
@dade80vr
dade80vr / checkcert.sh
Created November 1, 2018 21:12
Bash script to check if a certificate and a private key match
#!/bin/bash
cert=$1
key=$2
if [[ $# -eq 0 ]]
then
echo "Arguments not given. Usage: ./checkcert.sh CERTIFICATE.crt PRIVKEY.key"
else
crthash=$(openssl x509 -noout -modulus -in "$cert" | openssl md5)
echo $cert $crthash
keyhash=$(openssl rsa -noout -modulus -in "$key" | openssl md5)
@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 / getphone.sh
Last active April 6, 2022 06:56
Bash script to find phone number by given query using Google Places API
#!/bin/bash
# Bash script to get phone number by name using Google Places API
# By Davide Permunian - https://github.com/dade80vr
# Last update: Dec 13, 2018
# Usage: ./getphone.sh "your query"
# Please change <your_api_key> - See https://developers.google.com/places/web-service/intro
apikey="<your_api_key>"
@dade80vr
dade80vr / query-ad-users.ps1
Created December 18, 2019 11:20
Usefull Powershell command for query Windows AD Users
#ACCOUNT BLOCCATI
get-aduser -Properties * -filter *| Where-Object {$_.LockedOut -eq $true} | select displayname,samaccountname | sort-object displayname | export-csv -Path e:\Test\users_Locked.csv -NoTypeInformation
#ACCOUNT DISABILITATI
get-aduser -Properties * -filter *| Where-Object {$_.Enabled -eq $false} | select displayname,samaccountname | sort-object displayname | export-csv -Path e:\Test\users_Disabled.csv -NoTypeInformation
#ACCOUNT ABILITATI
get-aduser -Properties * -filter *| Where-Object {$_.Enabled -eq $true} | select displayname,samaccountname | sort-object displayname | export-csv -Path e:\Test\users_Enabled.csv -NoTypeInformation
#ACCOUNT ATTIVI CON PSW SENZA SCADENZA
@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
@dade80vr
dade80vr / quickversioning.class.php
Last active January 2, 2020 10:17
[PHP] Auto git versioning by last tag + commit counter
class QuickVersioning {
/*
Auto versioning by Git TAG + COMMIT
by Davide Permunian - https://github.com/dade80vr
*/
public static function version() {
exec('git describe --abbrev=0 --tags',$last_tags);
if (count($last_tags)>0) {
@dade80vr
dade80vr / .netrc
Created November 15, 2018 13:09
Netrc file for HTTPS access without password to BitBucket or other servers (please put this file into your home dir)
machine bitbucket.org
login myusername
password mypassword
@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 / getsmc.sh
Last active August 8, 2018 13:28
Get Ricoh SMC value by given file and SP number (usage: ./getsmc.sh E254CA30043_5992004_20170706_095042.csv SP7944 001)
#!/bin/bash
cat $1 | grep $2 -A 40 | awk '/-'$3'/ { print $(NF) }'