sabato 4 novembre 2023

Best dns 2023

 

Best Free & Public DNS Servers
ProviderPrimary DNSSecondary DNS
Google8.8.8.88.8.4.4
Control D76.76.2.076.76.10.0
Quad99.9.9.9149.112.112.112
OpenDNS Home208.67.222.222208.67.220.220
Cloudflare1.1.1.11.0.0.1
CleanBrowsing185.228.168.9185.228.169.9
Alternate DNS76.76.19.1976.223.122.150
AdGuard DNS94.140.14.1494.140.15.15

domenica 4 giugno 2023

SSH server on Windows

Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'


Name : OpenSSH.Client~~~~0.0.1.0 State : NotPresent Name : OpenSSH.Server~~~~0.0.1.0 State : NotPresent


# Install the OpenSSH Client

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0


# Install the OpenSSH Server

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0


Path : Online : True RestartNeeded : False


# Start the sshd service

Start-Service sshd


# OPTIONAL but recommended:

Set-Service -Name sshd -StartupType 'Automatic'


# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify

if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {

    Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."

    New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

} else {

    Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."

}


Ref: Installare OpenSSH | Microsoft Learn

Ref: Gestione delle chiavi OpenSSH

venerdì 6 novembre 2020

Linux benchmark disk

 

Terminal method

hdparm is a good place to start.

sudo hdparm -Tt /dev/sda

/dev/sda:
Timing cached reads:   12540 MB in  2.00 seconds = 6277.67 MB/sec
Timing buffered disk reads: 234 MB in  3.00 seconds =  77.98 MB/sec

sudo hdparm -v /dev/sda will give information as well.


dd will give you information on write speed.

If the drive doesn't have a file system (and only then), use of=/dev/sda.

Otherwise, mount it on /tmp and write then delete the test output file.

dd if=/dev/zero of=/tmp/output bs=8k count=10k; rm -f /tmp/output

10240+0 records in
10240+0 records out
83886080 bytes (84 MB) copied, 1.08009 s, 77.7 MB/s


martedì 28 gennaio 2020

Install pgAdmin4 on Ubuntu 18.04

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

sudo apt install wget ca-certificates

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add

sudo apt update

sudo apt install pgadmin4

giovedì 14 novembre 2019

Speedtest-cli


curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -

giovedì 7 novembre 2019

Gestore docker - portainer.io

https://www.portainer.io/installation/

$ docker volume create portainer_data

$ docker run -d -p 8000:8000 -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

mercoledì 2 ottobre 2019

How to Set Linux's Display Resolution to 1920x1080 in VMWare

xrandr --newmode "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --addmode Virtual1 1920x1080
xrandr --output Virtual1 --mode 1920x1080

mercoledì 3 aprile 2019

ORACLE - Kill session

lunedì 3 dicembre 2018

CORS - Tomcat - Geoserver

To add CORS headers, I simply added to $CATALINA_HOME/conf/web.xml the following lines:

mercoledì 18 luglio 2018

Arcpy - Update SHAPE@M using Field Value

import arcpy
fc = "LD17_CIPPI"
fields = ['ID', 'KM','SHAPE@M']
with arcpy.da.UpdateCursor(fc, fields) as cursor:
 for row in cursor:
  print row[0]
  row[2] = row[1]
  cursor.updateRow(row)
 
#verify
with arcpy.da.SearchCursor(fc, fields) as cursor:
 for row in cursor:
  print row[0], row[1], row[2]

martedì 19 giugno 2018

arcpy: Accessing parameters in a script tool


The illustration below shows a script tool dialog box with three parameters: an input workspace, a clip feature class, and an output workspace. All feature classes in the input workspace are clipped to the clip feature class (using the Clip tool) and written to the output workspace.
Script tool parameters
In the illustration above, once parameter values have been entered on the tool dialog box and the OK button is clicked, the script reads the values of the parameters using GetParameterAsText(), as follows:
# Import arcpy site-package
#
import arcpy
from arcpy import env

# Read the parameter values:
#  1: input workspace
#  2: input clip features
#  3: output workspace
#
inWorkspace   = arcpy.GetParameterAsText(0)
clipFeatures  = arcpy.GetParameterAsText(1)
outWorkspace  = arcpy.GetParameterAsText(2)
env.workspace = inWorkspace

sys.argv and arcpy.GetParameterAsText

There are two methods for reading parameters: sys.argv and the arcpy function GetParameterAsText(). Either approach can be used. The example above could be rewritten to use sys.argv:
# Read the parameter values:
#  1: input workspace
#  2: input clip features
#  3: output workspace
#
inWorkspace   = sys.argv[1]
clipFeatures  = sys.argv[2]
outWorkspace  = sys.argv[3]
env.workspace = inWorkspace
sys.argv has limitations on the number of characters it can accept. GetParameterAsText() has no character limit. For this reason alone, it is recommended that you use GetParameterAsText.
sys.argv[0] returns the script file name.

martedì 5 giugno 2018

Python: Convert string to number/float

# consigliato
import re
a="PL Km 274+169 (Privato)" 
valore = str(re.sub("[^0-9,+]", "",a)).replace('+','.').replace(',','.')
print valore

result:
274.169

import string
a="PL Km 274+169 (Privato)" 
all=string.maketrans('+','.')
nodigs=all.translate(all, string.digits)
print  str(float(a.translate(all, nodigs)))

import re
a="PL Km 274+169 (Privato)" 
a.replace("+",".")
value = float(re.sub("[^0123456789\.]","",a))
print value

# consigliato
import re
def converti(a):
 valore = str(re.sub("[^0-9,+]", "",a)).replace('+','.')
 return float(valore)

import string
a="PL Km 274+169 (Privato)" 
all=string.maketrans('+','.')
nodigs=all.translate(all, string.digits)
print  str(float(a.translate(all, nodigs)))

result:
274.169

venerdì 11 maggio 2018

SQL ORACLE: LEAD

SELECT last_name, hire_date, LEAD(hire_date, 1) OVER (ORDER BY hire_date) AS "NextHired" FROM employees WHERE department_id = 30; LAST_NAME HIRE_DATE NextHired ------------------------- --------- --------- Raphaely 07-DEC-94 18-MAY-95 Khoo 18-MAY-95 24-JUL-97 Tobias 24-JUL-97 24-DEC-97 Baida 24-DEC-97 15-NOV-98 Himuro 15-NOV-98 10-AUG-99 Colmenares 10-AUG-99

martedì 13 marzo 2018

How to convert milliseconds to date string in Oracle SQL

select to_char(to_date('1970-01-01 00','yyyy-mm-dd hh24') + (1517356800000)/1000/60/60/24 , 'YYYY-MM-DD HH24:MI:SS') datestr from dual;

lunedì 18 dicembre 2017

SQL ORACLE: Trasformare stringa in tabella

SELECT Replace(CAMPO,'''','') CAMPO FROM ( SELECT * FROM dual PIVOT ( COUNT(*) FOR (DUMMY) IN ( 'CNR1','321G','321H','321I' ))) mytab UNPIVOT INCLUDE NULLS ( VAL FOR( CAMPO ) IN ( "'CNR1'","'321G'","'321H'","'321I'" ) );

Best dns 2023

  Best Free & Public DNS Servers Provider Primary DNS Secondary DNS Google 8.8.8.8 8.8.4.4 Control D 76.76.2.0 76.76.10.0 Quad9 9.9.9.9 ...