Skip to content

Instantly share code, notes, and snippets.

View xardit's full-sized avatar
🍀

Ardit Hyka xardit

🍀
View GitHub Profile
@xardit
xardit / create.md
Last active February 10, 2024 21:53
Virtual Box create physicaldrive0.vmdk disk with cmd to access raw disk

Run only on cmd > run as admin

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" createmedium disk --filename physicaldrive0.vmdk --format=VMDK --variant RawDisk --property RawDrive=\\.\PhysicalDrive0

When adding to virtual disk manager on virtual box, make sure to run virtual box directly from the .exe file as administrator

To list Host drives using vboxmanage.exe

@xardit
xardit / copy.sh
Created February 4, 2024 20:55
Docker quick copy local folder (a mysql folder) to existing volume
#!/bin/bash
# test
docker run -it --rm -v wordpress-nginx-docker_mysql-data:/dest alpine
# delete
docker run --rm -v wordpress-nginx-docker_mysql-data:/dest -w /source alpine rm -rf /dest/*
# copy
docker run --rm -v $PWD:/source -v wordpress-nginx-docker_mysql-data:/dest -w /source alpine cp dbdata/* /dest/
@xardit
xardit / config.txt
Created January 13, 2024 14:46
Equalizer APO - HyperX Cloud III - Optimize common usage - Optimize Valorant gameplay sounds
# AutoEQ.app for HyperX Cloud III
# GraphicEQ: 20 -1.2; 21 -0.9; 22 -0.7; 23 -0.6; 24 -0.5; 26 -0.3; 27 -0.3; 29 -0.2; 30 -0.2; 32 -0.3; 34 -0.5; 36 -0.6; 38 -0.8; 40 -1.1; 43 -1.5; 45 -1.8; 48 -2.2; 50 -2.5; 53 -2.8; 56 -3.1; 59 -3.3; 63 -3.6; 66 -3.7; 70 -3.9; 74 -4.1; 78 -4.2; 83 -4.2; 87 -4.2; 92 -4.1; 97 -3.9; 103 -3.7; 109 -3.6; 115 -3.4; 121 -3.3; 128 -3.3; 136 -3.4; 143 -3.5; 151 -3.6; 160 -3.8; 169 -4; 178 -4.2; 188 -4.5; 199 -4.8; 210 -5; 222 -5.4; 235 -5.7; 248 -5.9; 262 -6.1; 277 -6.3; 292 -6.6; 309 -6.8; 326 -7; 345 -7.1; 364 -7.2; 385 -7.3; 406 -7.5; 429 -7.5; 453 -7.6; 479 -7.6; 506 -7.6; 534 -7.7; 565 -7.8; 596 -8; 630 -8.3; 665 -8.7; 703 -9; 743 -9.1; 784 -9.3; 829 -9.4; 875 -9.4; 924 -9.4; 977 -9.3; 1032 -9.1; 1090 -8.9; 1151 -8.9; 1216 -9.1; 1284 -9.2; 1357 -9.3; 1433 -9.4; 1514 -9.5; 1599 -9.6; 1689 -9.6; 1784 -9.6; 1885 -9.2; 1991 -8.4; 2103 -7.6; 2221 -6.9; 2347 -6.4; 2479 -6.3; 2618 -5.9; 2766 -4.9; 2921 -4.2; 3086 -4.3; 3260 -5.5; 3443 -5.8; 3637 -4.3; 3842 -2.9; 4058 -2.7; 4287 -3.7;
@xardit
xardit / run.py
Created December 24, 2023 15:09
Remove recursively md5 hash string from filenames - Python script
"""
Remove recursively md5 hash string from filenames on files and directories from notion export
and reuse them directly on obsidian vault.
The md5 string is added by Notion on export by default!
@by Ardit
"""
import os
import re
@xardit
xardit / functions.php
Created July 4, 2023 12:26
WP Custom Upload MIME types
<?php
function my_custom_mime_types( $mimes ) {
// New allowed mime types.
$mimes['svg'] = 'image/svg+xml';
$mimes['svgz'] = 'image/svg+xml';
$mimes['doc'] = 'application/msword';
// Optional. Remove a mime type.
unset( $mimes['exe'] );
@xardit
xardit / functions.php
Created June 30, 2023 13:17
WP Disable XMLRPC via functions
<?php
// disable xmlrpc
add_filter( 'xmlrpc_enabled', '__return_false' );
@xardit
xardit / script.js
Created June 25, 2023 17:21
WhatsApp Icon Floating in Javascript
(function(d) {
var phone = '+1234567';
var text = "Hello, I'm interested for: " + window.location.href;
if(!window.location.pathname.startsWith("/products")){
text = "Hello, I'm interested..";
}
var link = d.createElement('a');
var style = d.createElement('style');
@xardit
xardit / functions.php
Created June 23, 2023 21:03
WP Hardcode Language Attribute on HEAD
<?php
// set language attribute of the main <html> tag hardcoded
function new_language_attributes($lang){
return "lang=\"it\"";
}
add_filter('language_attributes', 'new_language_attributes');
@xardit
xardit / functions.php
Created June 23, 2023 21:02
WP Change Language Attribute on HEAD based on specific slug
<?php
// set language attribute of the main <html> tag based on category value
function new_language_attributes($lang){
if(is_single()) {
$ar = get_the_category();
foreach($ar as $c) {
if($c->slug=='in-italiano') {
return "lang=\"it\"";
}
@xardit
xardit / functions.php
Created June 14, 2023 07:26
WP Woocommerce - Clear cart before adding new one
<?php
// clear cart before adding new one
add_filter( 'woocommerce_add_to_cart_validation', 'remove_cart_item_before_add_to_cart', 20, 3 );
function remove_cart_item_before_add_to_cart( $passed, $product_id, $quantity ) {
if( ! WC()->cart->is_empty() )
WC()->cart->empty_cart();
return $passed;
}