Skip to content

Instantly share code, notes, and snippets.

View IlanVivanco's full-sized avatar
💡
Coding!

Ilán Vivanco IlanVivanco

💡
Coding!
View GitHub Profile
REM WSL symlink guide here https://dev.to/themartes_/how-to-make-wsl2-even-faster-with-fast-git-28p8
REM ---------------------
REM Now when we have our script we need to run it every time we boot into our machine. We also need to do that with the highest privileges because you need to be an admin to make a symlink from network drive to your base drive.
REM So go ahead and search for Task Scheduler. On the left sidebar you will see Task Scheduler Library. Click on it and on the right sidebar click on Create Task....
REM Now make sure you'll give a name to your task, then write a little description and Check "Run with highest privileges". Also make sure you'll change Configure for: To Windows10
REM Next click on Triggers tab and add new trigger. This will look fairly simple, Just make sure it's like this, and click OK.
REM Next click on Actions add New and Select the .bat script we created earlier with the following code:
REM ---------------------
@echo off
@IlanVivanco
IlanVivanco / settings.json
Last active August 18, 2020 17:57
Windows Terminal Settings
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
"initialCols": 120,
"initialRows": 30,
"copyOnSelect": true,
"profiles": {
"defaults": {
"acrylicOpacity": 0.85,
"cursorColor": "#CCC",
@IlanVivanco
IlanVivanco / wp_debug_snippet.php
Last active June 8, 2021 14:24
WP debug snippets
<?php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
// Logs the nmae of the function
error_log( '>>> IN ' . __FUNCTION__ );
@IlanVivanco
IlanVivanco / download.sh
Last active April 14, 2020 13:30
Download images from URL from list
while read -r url name ; do
wget -O $name $url
done < images.txt
@IlanVivanco
IlanVivanco / data.js
Last active March 16, 2021 13:29
Get certain data from element page
‎‎​let data = [];
$('[id^=form_19]').each((i, e) => {
let elm = $(e).find('> form');
data.push(elm.data('formId'))
});
copy(data);
@IlanVivanco
IlanVivanco / replace_serialized.sql
Last active March 16, 2021 13:28
Replace serialized data
SET
@search := 'https://website.com/wp-content/uploads/2019/10/the_original_image.jpg';
--COLLATE utf8mb4_unicode_520_ci;
SET
@replace := 'https://website.com/wp-content/uploads/2019/10/the_new_image.jpg';
--COLLATE utf8mb4_unicode_520_ci;
UPDATE
wp_postmeta
@IlanVivanco
IlanVivanco / replace_accents.sql
Last active October 16, 2019 18:03
Replace accents
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Š','S');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'š','s');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ð','Dj');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ž','Z');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ž','z');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'À','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Á','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Â','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ä','A');
@IlanVivanco
IlanVivanco / wp_library_size.php
Last active March 16, 2021 13:00
Media library size Dashboard Widget
<?php
add_action( 'wp_dashboard_setup', 'iv_wp_dashboard_setup' );
function iv_wp_dashboard_setup() {
if( current_user_can( 'install_plugins' ) )
wp_add_dashboard_widget( 'iv_folder_sizes', __( 'Folder Sizes' ), 'iv_wp_add_dashboard_widget' );
}
function iv_wp_add_dashboard_widget() {
$upload_dir = wp_upload_dir();
@IlanVivanco
IlanVivanco / update_post_count_on_tax.sql
Last active March 16, 2021 13:26
Update Post Count on Taxonomies
UPDATE
wp_term_taxonomy
SET
count = (
SELECT
COUNT(*)
FROM
wp_term_relationships rel
LEFT JOIN wp_posts po ON (po.ID = rel.object_id)
WHERE
@IlanVivanco
IlanVivanco / autoloaded_data.sql
Last active March 16, 2021 13:26
Show WP autoloaded data
SELECT
'autoloaded data' as name,
ROUND(SUM(LENGTH(option_value))) as value
FROM
wp_options
WHERE
autoload = 'yes'
UNION
SELECT
'autoloaded data count',