Skip to content

Instantly share code, notes, and snippets.

View anunay's full-sized avatar
🏠
Working from home

Anunay Dahal anunay

🏠
Working from home
View GitHub Profile
@anunay
anunay / wp_permissions.sh
Created July 20, 2023 07:58 — forked from monkishtypist/wp_permissions.sh
WordPress file/folder permissions for Amazon EC2 Ubuntu instance
#!/bin/bash
# Location: Anywhere
# Add existing 'ubuntu' user to 'www-data' group
sudo usermod -a -G www-data ubuntu;
# Set the ownership of the files/directories
sudo chown -R www-data:www-data /var/www/html/;
# Set group ownership inheritance
@anunay
anunay / fix-wordpress-ftp-credentials-popup.php
Last active May 5, 2023 06:25
Fix WordPress FTP credentials popup
/* Please add the following code at the bottom of the wp-config.php file */
define('FS_METHOD', 'direct');
define('FS_CHMOD_DIR',0755);
define('FS_CHMOD_FILE',0644);
@anunay
anunay / create_delivered_status.php
Created October 1, 2020 18:11 — forked from zorem/create_delivered_status.php
From this code snippet you can create custom order status delivered
<?php
// Add this code to your theme functions.php file or a custom plugin
add_action('init', 'register_order_status');
//add status after completed
add_filter('wc_order_statuses', 'add_delivered_to_order_statuses');
//Custom Statuses in admin reports
add_filter('woocommerce_reports_order_statuses', 'include_custom_order_status_to_reports', 20, 1);
// for automate woo to check order is paid
add_filter('woocommerce_order_is_paid_statuses', 'delivered_woocommerce_order_is_paid_statuses');
@anunay
anunay / debug.keystore android
Created September 3, 2019 03:49
Create debug.keystore android for react native
keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
@anunay
anunay / MacOS Kill all apache or httpd process and stop loading
Created August 28, 2019 05:16
MacOS Kill all Apache / httpd process and stop loading them at startup, tested upto MacOS Catalina
// Kills all httpd process from running
sudo killall httpd
// Disables startup loading when system starts
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist
@anunay
anunay / verifyEmail.php
Created November 28, 2018 00:11
Verify Email with PHP
<?php
/* Credit: https://github.com/hbattat/verifyEmail */
function verifyEmail($toemail, $fromemail, $getdetails = false)
{
// Get the domain of the email recipient
$email_arr = explode('@', $toemail);
$domain = array_slice($email_arr, -1);
$domain = $domain[0];
@anunay
anunay / create-csr-for-ssl-certs.sh
Created December 5, 2017 17:59
Create CSR - SSL
openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr
@anunay
anunay / dump-database.sh
Last active July 16, 2019 14:11
MYSQL : Dump database with procedures, functions, views & triggers.
#Export database with all procedures, functions, views & triggers along with the table structures and their data.
mysqldump <other mysqldump options> --routines export.sql
@anunay
anunay / dump-functions-procedures.sh
Last active November 16, 2017 16:11
Dump Functions, Procedures, Views & Triggers from MySQL
// you should run this commend once you are logged into the server
mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt <database> > export.sql
@anunay
anunay / download-using-ssh.txt
Created November 16, 2017 15:53
Download Files from server using SSH
scp username@remotehost.com:youfile.zip /local/directory