Skip to content

Instantly share code, notes, and snippets.

View Faisalawanisee's full-sized avatar
🎯
Focusing

Faisal Khalid Faisalawanisee

🎯
Focusing
View GitHub Profile
<?php
function fab_woocommerce_product_importer_pre_expand_data($data)
{
$ext = "jpg";
$sku = $data['sku'];
$url = "https://sample.com/images/";
if (isset($data['images'])) {
$images = $data['images'];
@Faisalawanisee
Faisalawanisee / upload-a-file.MD
Created September 2, 2021 15:53 — forked from ahmadawais/upload-a-file.MD
Upload a file using the WordPress REST API

Upload files

Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a POST-Request to the wp/v2/media route.

There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle:

@Faisalawanisee
Faisalawanisee / infectedFiles.md
Created September 24, 2020 22:51 — forked from frosit/infectedFiles.md
Some commands for finding and clearing infected PHP files

Finding infected files with following bash commands

** Command to list all infected files:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot
  • grep -lr --include=*.php "eval" .
  • grep -lr --include=*.php "base64" .

Command to remove malicious code:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot | xargs sed -i.bak 's/<?php eval(base64_decode[^;]*;/<?php\n/g'
<?php
/*
Created by: craig@123marbella.com 16/03/2014
Name of script: Create WordPress Admin User
Description: This script will create an admin user in wordpress
Usage: Create a new file in the root of the hosting account and drop this code into it then execute the script through the browser.
{
"countries": [
{
"country": "Afghanistan",
"states": ["Badakhshan", "Badghis", "Baghlan", "Balkh", "Bamian", "Daykondi", "Farah", "Faryab", "Ghazni", "Ghowr", "Helmand", "Herat", "Jowzjan", "Kabul", "Kandahar", "Kapisa", "Khost", "Konar", "Kondoz", "Laghman", "Lowgar", "Nangarhar", "Nimruz", "Nurestan", "Oruzgan", "Paktia", "Paktika", "Panjshir", "Parvan", "Samangan", "Sar-e Pol", "Takhar", "Vardak", "Zabol"]
},
{
"country": "Albania",
"states": ["Berat", "Dibres", "Durres", "Elbasan", "Fier", "Gjirokastre", "Korce", "Kukes", "Lezhe", "Shkoder", "Tirane", "Vlore"]
},
@Faisalawanisee
Faisalawanisee / new-apache2-site.sh
Created August 27, 2019 19:41 — forked from hcooper/new-apache2-site.sh
Script to automate creating new apache2 virtual hosts
#! /bin/bash
# Script to automate creating new apache2 virtual hosts.
# Logs go in /var/log/apache2/$SN
# DocRt is /var/www-vhosts/$SN
# SN = shortname -- used for directory names etc.
# DN = domainname -- used only in apache config file
#
# H Cooper - 18/10/06
#
@Faisalawanisee
Faisalawanisee / 01_setup_lets_encrypt.sh
Last active August 27, 2019 19:41 — forked from gene1wood/01_setup_lets_encrypt.sh
Example of how to setup Let's Encrypt on RHEL / CentOS and automate certificate rewnewal
#!/bin/bash
EMAIL=john.doe@example.com
DOMAINS=example.com,www.example.com,foo.example.com,example.org.example.net,www.example.org,www.example.net
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt/
mkdir -p /var/lib/letsencrypt/global-webroot
# Setup the global alias
@Faisalawanisee
Faisalawanisee / create-project.sh
Created August 27, 2019 16:50 — forked from jasonlewis/create-project.sh
Bash script that creates a new project and virtual host for that project. Can also be used to quickly create a new Laravel project.
#!/bin/bash
# This script creates a new project (or site) under /var/sites and creates
# new virtual host for that site. With the options a site can also
# install the latest version of Laravel directly.
# This script was originally based on the following script by @Nek from
# Coderwall: https://coderwall.com/p/cqoplg
# Display the usage information of the command.
create-project-usage() {
@Faisalawanisee
Faisalawanisee / wp.sh
Created February 10, 2019 18:52 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@Faisalawanisee
Faisalawanisee / wp_auto_install.sh
Created February 10, 2019 18:52 — forked from nicomollet/wp_auto_install.sh
WP-CLI auto install script
#!/bin/bash
# Default options
LOCALE="fr_FR"
DB_HOST='localhost'
VIRUSTOTAL_KEY='YOUR_KEY'
printf "Name of the project? cf My Project: "
read PROJECT_NAME