Skip to content

Instantly share code, notes, and snippets.

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

Pritpal Singh pritdeveloper

🏠
Working from home
View GitHub Profile
#sub-domain to sub-folder
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com
RewriteRule ^(.*)$ http://domain.com/subdomains/%1/$1 [L,NC,QSA]
# common
alias ls='ls --color=auto -F'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias less="less -R "
alias ..="cd ../"
if( !function_exists( 'pr' ) ) {
function pr() {
foreach( func_get_args() as $e ) {
echo "<pre>";
print_r( $e );
echo "</pre>";
}
}
}
@pritdeveloper
pritdeveloper / git_aliases
Last active September 1, 2018 22:46
aliases for git | curl {RAW_URL} >> ~/.gitconfig
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
le = log --oneline --decorate
fl = log -u
// define plugin variables
define( 'PLUGIN_PATH', rtrim( plugin_dir_path( __FILE__ ), '/' ) );
define( 'PLUGIN_URL', rtrim( plugin_dir_url( __FILE__ ), '/' ) );
@pritdeveloper
pritdeveloper / wc_order_status_changes.php
Created August 3, 2018 14:56 — forked from abegit/wc_order_status_changes.php
WooCommerce Hooks for Order Status Changes
function mysite_pending($order_id) {
error_log("$order_id set to PENDING", 0);
}
function mysite_failed($order_id) {
error_log("$order_id set to FAILED", 0);
}
function mysite_hold($order_id) {
error_log("$order_id set to ON HOLD", 0);
}
function mysite_processing($order_id) {
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-php7.0
sudo a2dismod php5
sudo a2enmod php7.0
sudo apt-get install php7.0-dom php7.0-mbstring php7.0-zip php7.0-mysql php7.0-sqlite php7.0-curl php7.0-gd
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-php7.1
sudo a2dismod php5
sudo a2enmod php7.1
sudo apt-get install php7.1-dom php7.1-mbstring php7.1-zip php7.1-mysql php7.1-sqlite php7.1-curl php7.1-gd
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-php7.2
sudo a2dismod php5
sudo a2enmod php7.2
sudo apt-get install php7.2-dom php7.2-mbstring php7.2-zip php7.2-mysql php7.2-sqlite php7.2-curl php7.2-gd
@pritdeveloper
pritdeveloper / reset root MySQL password.md
Last active June 18, 2024 06:03
reset root MySQL password

How to reset root MySQL password on Ubuntu

sudo mysql -u root
FLUSH PRIVILEGES;
USE mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';