Skip to content

Instantly share code, notes, and snippets.

View D4R4's full-sized avatar

Dara Ardalan D4R4

  • SCALINX
  • Paris, France
View GitHub Profile
@D4R4
D4R4 / rdp_license
Created June 22, 2019 06:36
Extend windows RDP graceperiod after 120 day trial expiration
hkey_local_machine\system\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod
-> Change permission to full control
--> delete the key inside
@echo off
REG DELETE \\ServerName\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod /v L$RTMTIMEBOMB_1320153D-8DA3-4e8e-B27B-0D888223A588
net stop termservice
timeout 30
@D4R4
D4R4 / windows-eval
Last active May 22, 2022 20:22
Upgrade from Windows Evaluation mode
DISM /Online /Get-CurrentEdition
DISM /online /Set-Edition:ServerEdition /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula
@D4R4
D4R4 / wordpress_replace_text
Last active July 1, 2019 18:20
Replace text (olddomain,newdomain) in wordpress Options while keeping serialization intact using WP CLI
wp search-replace 'https://old-domain' 'https://new-domain' --skip-tables=wp_users --skip-columns=guid --dry-run
Remove --dry-run once you're sure nothing will be replaced that should not be.
You cannot do both a --dry-run and an --export=<filename> in the same command.
@D4R4
D4R4 / l2tpclient.sh
Last active September 5, 2019 08:02 — forked from danielv99/l2tpclient.sh
L2TP VPN client on Debian
# Requirements
# debian/ubuntu
apt-get -y update && apt-get -y upgrade
apt-get -y install strongswan xl2tpd libstrongswan-standard-plugins libstrongswan-extra-plugins
VPN_SERVER_IP=''
VPN_IPSEC_PSK='y'
VPN_USER=''
VPN_PASSWORD=''
@D4R4
D4R4 / php_serilizer.php
Created August 5, 2019 08:12
PHP corrupted serialized string fixer, usefull for Wordpress options data
function serialize_corrector($serialized_string){
// at first, check if "fixing" is really needed at all. After that, security checkup.
if ( @unserialize($serialized_string) !== true && preg_match('/^[aOs]:/', $serialized_string) ) {
$serialized_string = preg_replace_callback( '/s\:(\d+)\:\"(.*?)\";/s', function($matches){return 's:'.strlen($matches[2]).':"'.$matches[2].'";'; }, $serialized_string );
}
return $serialized_string;
}
@D4R4
D4R4 / htaccess.rewrite
Created August 13, 2019 09:34
Rewrite to custom directories befrore CMS rule applies. (wordpress,prestashop,...)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/store/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>
@D4R4
D4R4 / wordpress_find_replace_meta.php
Last active August 15, 2019 12:35
Handy tool to replace almost any data in wordpress, just put this in yout theme's directory and add a custom page with the template 'script' and go crazy. This one removes anchor links from Content column of post type 'series'.
<?php
/*
Template Name: script
*/
if ( trim($_GET["key"]) == "DKGJWOIGJDLGDFSDF") {
// Create the WP_User_Query object
$args = array(
'post_type' => 'series',
'post_status' => 'publish',
@D4R4
D4R4 / wordpress_action.php
Created August 29, 2019 16:22
CUSTOM COLUMNS FOR CUSTOM POST TYPES
add_filter( 'manage_edit-movie_columns', 'my_edit_movie_columns' ) ;
function my_edit_movie_columns( $columns ) {
$columns = array(
'cb' => '&lt;input type="checkbox" />',
'title' => __( 'Movie' ),
'duration' => __( 'Duration' ),
'genre' => __( 'Genre' ),
'date' => __( 'Date' )
@D4R4
D4R4 / .htaccess
Last active September 5, 2019 07:23
Add this to prestashop htaccess to prevent Authentication prompt glitch and Unauthorized status in API interactions
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
@D4R4
D4R4 / selector.css
Created September 10, 2019 07:46
CSS Selector by attributes and wildcard values
/* match start and end */
.regular-text[id^="order_items_group_order_items_"][id$="_name"]
{
content: Kappa;
}