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 / 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 / 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 / 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 / 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 / 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 / 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) }'
@dade80vr
dade80vr / gitprettylog.sh
Created August 7, 2018 09:16
Git pretty & short status log
git log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=short
@dade80vr
dade80vr / mail.sh
Last active May 24, 2018 20:03
Easy send mail from bash/shell to your preferred recipient with sendemail
#!/bin/bash
recipient="your@mail.com"
smtp="smtp.gmail.com"
oldmode=`stty -g`
echo -n "Insert your Gmail pass: "
stty -echo
read gpass
stty $oldmode
echo
echo
@dade80vr
dade80vr / chkown.sh
Last active September 5, 2017 13:03
Bash script to check a given folder owner - Require AWK
#!/bin/bash
# Bash script to check a given folder owner - Require AWK
# By Davide Permunian (https://github.com/dade80vr)
#
# Usage : ./chkown.sh <folder>
# Example : ./chkown.sh /usr/local
#unquote next line if you want an output
#echo -en "The owner of $1 is: "