This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
import random | |
# Funzione per un passo casuale in due dimensioni | |
def random_step(): | |
return random.choice([(0, 1), (0, -1), (1, 0), (-1, 0)]) | |
# Funzione per eseguire la random walk in due dimensioni | |
def random_walk_2d(steps): | |
positions = [(0, 0)] # Inizializza la posizione iniziale |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
import random | |
# Funzione per un passo casuale a destra o sinistra | |
def random_step(): | |
return random.choice([-1, 1]) | |
# Funzione per eseguire il random walk | |
def random_walk(steps): | |
positions = [0] # Inizializza la posizione iniziale |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compress(uncompressed): | |
"""Compress a string to a list of output symbols.""" | |
# Build the dictionary. | |
dict_size = 256 | |
dictionary = dict((chr(i), i) for i in range(dict_size)) | |
# in Python 3: dictionary = {chr(i): i for i in range(dict_size)} | |
w = "" | |
result = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ## ## ## ## ## ## ## ## ## ## ## ## ## - | |
## ## wp_postmeta | |
## ## ## ## ## ## ## ## ## ## ## ## ## ## - | |
## minusc | |
UPDATE wp_postmeta SET meta_key = replace(meta_key, "Ã ", "à"); | |
UPDATE wp_postmeta SET meta_key = replace(meta_key, "è", "è"); | |
UPDATE wp_postmeta SET meta_key = replace(meta_key, "ì", "ì"); | |
UPDATE wp_postmeta SET meta_key = replace(meta_key, "ò", "ò"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
/* | |
Plugin Name: Manual Autopublisher (no backend) | |
Plugin URI: https://capolooper.it | |
Description: Quickly and easily auto republish random old posts | |
Version: 0.1 | |
Author: Salvatore | |
Author URI: https://capolooper.it | |
License: GPL2 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>FORM</title> | |
</head> | |
<body> | |
<h1>Inserimento cliente</h1> | |
<form method="post" action="insert-db.php"> <!-- importante! --> | |
<table border=1> | |
<tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- riepilogo della sintassi più importante in SQL | |
-- SQL inizia SEMPRE con ... | |
CREATE DATABASE nome_database; | |
CREATE TABLE Customers ( | |
id INT AUTO_INCREMENT PRIMARY KEY, | |
CustomerName VARCHAR(60) NOT NULL, | |
ContactName VARCHAR(70) NOT NULL, | |
Address VARCHAR(100) NOT NULL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function palindrome(str) { | |
// Step 1. Lowercase the string and use the RegExp to remove unwanted characters from it | |
var re = /[\W_]/g; // or var re = /[^A-Za-z0-9]/g; | |
var lowRegStr = str.toLowerCase().replace(re, ''); | |
// str.toLowerCase() = "A man, a plan, a canal. Panama".toLowerCase() = "a man, a plan, a canal. panama" | |
// str.replace(/[\W_]/g, '') = "a man, a plan, a canal. panama".replace(/[\W_]/g, '') = "amanaplanacanalpanama" | |
// var lowRegStr = "amanaplanacanalpanama"; | |
// Step 2. Use the same chaining methods with built-in functions from the previous article 'Three Ways to Reverse a String in JavaScript' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Trovare file che occupano più spazio via SSH | |
find / -size +250M -ls | |
-- | |
Liberare spazio su disco Linux via SSH | |
cd / | |
sudo du -h --max-depth=1 | |
- Note which directories are using a lot of disk space. | |
- cd into one of the big directories. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aggiornato al 18 luglio 2021 |