Skip to content

Instantly share code, notes, and snippets.

View grimmo's full-sized avatar

Luigi grimmo

View GitHub Profile
@grimmo
grimmo / rilevaosver.bat
Last active December 13, 2019 08:30
Rileva versione Windows macchine in dominio
dsquery * -filter "(&(objectCategory=computer)(!userAccountControl:1.2.840.113556.1.4.803:=2))" -limit 0 -attr cn operatingSystemVersion > elenco.txt
REM for /F %I in ('type elenco.txt') do systeminfo /S %I | findstr "host OS "
@grimmo
grimmo / setta_data.sh
Created July 26, 2017 12:33
Set the timestamp via exiftool based on directory name structure
for foto in `find . -name "*.jpg" -not -path "*/.xvpics/*"` ; do DATAFOTO=`dirname $foto | cut -d '.' -f3,4 | cut -d '-' -f1 | sed -e 's/^/19/'| sed -e 's/[a-z]//g' | tr '.' ':' | sed -e 's/$/:01 00:00:00/'` ; if [ ${#DATAFOTO} -eq 19 ] ; then exiftool "-AllDates=$DATAFOTO" "$foto"; fi ; done
@grimmo
grimmo / README.md
Created December 14, 2016 12:58 — forked from ruario/README.md
Installs (or updates) PPAPI Flash, so that it can be used by Chromium-based browsers

Usage

To use this script click on the "Download ZIP" button listed on the GitHub Gist page and then unpack the .zip archive locally. You should now have a directory containing the file "latest-pepper-flash.sh".

Open a terminal within that directory and run the script like so:

sh latest-pepper-flash.sh

The script will fetch and install the latest Pepper Flash. From time to time (perhaps once a month) you should re-run this script and if there is a newer Flash it will upgrade your installed copy, otherwise it will just confirm that you have the latest version.

@grimmo
grimmo / list_all_vms.sh
Created June 7, 2016 09:00
Lists all VMs on all hosts from a vCenter server using vCLI and a vSphere API perl script
#!/bin/bash
# Lists all VMs on all hosts from a vCenter server
# requires https://gist.github.com/grimmo/2bc0b207c2c7ff493e04167f25c2de09
echo One moment please...
for vhost in $(./list_hosts_on_vcenter.pl); do
echo Virtual Machines on server $vhost
vmware-cmd --server <VCENTER SERVER FQDN OR IP ADDRESS> --vihost $vhost --credstore <PATH TO EXISTING CREDENTIALS STORE> -l
echo
done
@grimmo
grimmo / list_hosts_on_vcenter.pl
Last active March 16, 2022 23:11
List all hosts on a vCenter server using vSphere Perl API
#!/usr/bin/perl -w
# Lists all ESXi hosts on a vCenter
# Original script by natxo asenjo on Server Fault https://serverfault.com/a/627627
#
# You should have the following variables defined in ~/.visdkrc
# VI_PROTOCOL=https
# VI_SERVER=<IP ADDRESS OR FQDN OF VCENTER SERVER>
# VI_SERVICEPATH=/sdk
# VI_USERNAME=<VCENTER USERNAME>
#
@grimmo
grimmo / .bash_aliases_docker_vmwareutils
Last active June 7, 2016 09:08
Aliases to run vmware-utils commands from docker
# utility functions to launch vmware-utils commands using a dedicated docker container
#
# requires https://gist.github.com/grimmo/2bc0b207c2c7ff493e04167f25c2de09 (Perl script to enumerate vCenter hosts)
# and https://gist.github.com/grimmo/4db8a590735b46dff08e002272f7adda (Bash script to enumerate all VMs on a single host)
#
# This is the docker image I am using:
# docker pull ashleymichaelwilliams/vmware-utils
# 1. Start a container and spawn a shell to it
# docker run ashleymichaelwilliams/vmware-utils -it bash
# 2. Create a credentials store
@grimmo
grimmo / basket.py
Created February 17, 2016 09:06
Gioca al doodle partita di basket di Google
# Gioca al doodle del basket di Google
# liberamente adattato da https://gist.github.com/3287367
import time
import pyatspi
VK_CODE = {'spazio':65 }
def premi(x):
"Tieni premuto il tasto"
pyatspi.Registry.generateKeyboardEvent(VK_CODE[x], None, pyatspi.KEY_PRESS)
@grimmo
grimmo / newnange.py
Created February 17, 2016 09:00
Convertitore da ALEPH XML a Excel tab delimited
#!/usr/bin/env python
# -*- coding: utf-8 -*
import mmap,re,sys,csv
def check_multiple_items(fields):
for ciccio in filter(lambda x:'##' in x,campi):
for i in ciccio.split('##'):
nl = filter(lambda x:x != ciccio,campi)
nl.insert(campi.index(ciccio),i)
check_multiple_items(nl)
@grimmo
grimmo / scavezzacollo.py
Created February 17, 2016 07:43
Stampa etichette di collocazione da ALEPH 500
#!/usr/bin/env python
import re
from subprocess import call
import sys
def scavezza_classic(collo):
if collo != '':
print ("Collocazione in entrata: %s" % collo)
# Vuolsi cosi' cola' ove si puote
newcollo = re.sub('Statistiche','ST.PER.ST',collo)
newcollo = newcollo.split(' ')
@grimmo
grimmo / mannaggia.sh
Last active October 28, 2015 12:21 — forked from joxer/Italian Christmas
Tira giù tutti i santi dal calendario
#!/bin/bash
# richiede pacchetti espeak mbrola-it3
while [ 1 ]
do
MANNAGGIA="Mannaggia a san`curl -s www.santiebeati.it/$(</dev/urandom tr -dc A-Z|head -c1)/|grep -a tit|cut -d'>' -f5|cut -d'<' -f1|shuf -n1`"
echo "$MANNAGGIA"