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
// ❌ Without CTEs | |
SELECT customer_id, COUNT(order_id) AS order_count | |
FROM ( | |
SELECT customer_id, order_id | |
FROM orders | |
WHERE order_date >= '2023-01-01' AND order_date <= '2023-12-31' | |
) AS yearly_orders | |
GROUP BY customer_id | |
HAVING COUNT(order_id) > 5; |
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
> CREATE ROLE name_readonly WITH | |
NOLOGIN | |
NOSUPERUSER | |
NOCREATEDB | |
NOCREATEROLE | |
INHERIT | |
NOREPLICATION | |
CONNECTION LIMIT -1; | |
> GRANT CONNECT ON DATABASE db_name TO name_readonly; |
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
#https://askubuntu.com/questions/325807/arrow-keys-home-end-tab-complete-keys-not-working-in-shell | |
$> sudo chsh -s /bin/bash <username> |
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
> file * --mime-encoding | grep utf-8 |
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
# https://stackoverflow.com/questions/7632454/how-do-you-use-git-bare-init-repository | |
# I use this workflow to work with Git in a Windows Server (with several user accounts) only in Local mode. | |
# 1. Initialise the bare repo | |
> git init --bare "C:/git-repositories/chacho.git" | |
Initialised empty Git repository in C:/git-repositories/chacho.git/ | |
# 2a. Create a new working folder (no existing files) by cloning the empty repo | |
> git clone "C:/git-repositories/chacho.git" "C:/workplaces/chacho-project/master/" | |
Cloning into 'C:/workplaces/chacho-project/master/'... |
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
$str = 'In My Cart : 11 12 items'; | |
preg_match_all('!\d+!', $str, $number); | |
// array( array( '11', '12' ) ) | |
$str = '000031chacho87tio2loco'; | |
preg_match_all('!\d+!', $str, $number); | |
// array( array( '000031', '87', '2' ) ) |
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
// In the parent folder where wordpress is located, add the file 'environment' with the words 'DEVELOPMENT', 'PRODUCTION', | |
// or the environment label that you want. | |
// In wp-config.php add: | |
if( ! defined( 'WP_ENVIRONMENT' ) ) { | |
$dir_environment = dirname( dirname( __FILE__ ) ); | |
define( 'WP_ENVIRONMENT', empty( $dir_environment ) ? | |
'PRODUCTION' : file_get_contents( $dir_environment . 'environment' ) ); | |
} |
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
[Browser || Mobile] | |
href = https://api.whatsapp.com/send?text=&phone={{phone}} | |
# In browser: 2 clicks to access chat (if web.whatsapp is enabled) | |
[Mobile] | |
whatsapp://send?text=&phone={{phone}}&abid={{phone}} |
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
(In both Windows) | |
1. Go to C:\Users\{USER}\AppData\Roaming\AnyDesk | |
2. Copy & Paste 'thumbnails' | |
3. Open 'user.conf' | |
4. Replace the line 'ad.roster.items=' | |
5. Done. |
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
$> curl https://ipinfo.io/ip |
NewerOlder