One-liner: how to get Pulse Secure (Juniper SSL VPN) ACLs per role

Export ACLs as XML from the GUI into acls.xml file, then run the following command:

 

cat acls.xml | sed -e 's/&/\&/g' | awk '
BEGIN { acls=""; acl=0;}
/<network-connect-acl>/ { acl=1;}
/<resource>/ { if ( acl == 1) {a=gensub(".*<resource>(.*)<\/resource>.*","\\1","g",$0); acls = acls " " a; } } 
/<roles>/ { if (acl == 1) { roles[gensub(".*<roles>(.*)<\/roles>.*","\\1","g",$0)]=acls;} }
/<action>/ { if (acl == 1) { action=gensub(".*<action>(.*)<\/action>.*","\\1","g",$0)};}
/<\/network-connect-acl>/ { acl=0; acls=""; for ( i in roles) {printf("%s;%s;%s\n", i,roles[i],action);} delete roles;}' | sed -e 's/; /;/g' | less

The result will be shown in the following (semi-colon separated form):

Role;ACl1 ACL2 ACL3 …;action

One-liner: how to check temperature differences

The idea of this not-quite-one-liner is to periodically check the DIMM temperatures and show the differences (works in KSH, and does not work in BASH):

n=1

# Check all DIMM temperatures 
for temp in `sensors | fgrep DIMM | sed -e 's/°C.*//' -e 's/^.*+//' -e 's/\./,/'`
do

	(( B$n=$temp )) # temperature in the beginning
	(( D$n=$temp )) # current temperature
	(( n+=1 )) 	 	# next DIMM
done

while true
do

	sleep 10
	n=1
	for temp in `sensors | fgrep DIMM | sed -e 's/°C.*//' -e 's/^.*+//' -e 's/\./,/'`
	do
		(( temp_var=D$n ))
		(( DIFF1=$temp-$temp_var )) #temp diff from the last iteration
		(( temp_var=B$n ))
		(( DIFF2=$temp-$temp_var )) #temp diff from the beginning
		/bin/echo -e "$temp \t $DIFF2 \t $DIFF1"
		(( D$n=$temp ))
		(( n+=1 ))
	done
	echo ----------------------------------------
done

The result:

72,0 	 0 	 0
65,0 	 0 	 0
65,0 	 -0,5 	 -0,5
63,0 	 0 	 0
72,5 	 0 	 0
72,5 	 0 	 0
75,5 	 0 	 0
64,0 	 0 	 0
----------------------------------------
72,0 	 0 	 0
65,0 	 0 	 0
65,0 	 -0,5 	 0
63,0 	 0 	 0,5
72,5 	 0 	 0
72,5 	 0 	 0
75,5 	 0 	 0
64,0 	 0 	 0
----------------------------------------
71,0 	 -1 	 -1
65,0 	 0 	 0
65,0 	 -0,5 	 0
62,5 	 -0,5 	 -0,5
72,5 	 0 	 0
72,5 	 0 	 0
75,5 	 0 	 0
64,0 	 0 	 0
----------------------------------------