Skip to content

Instantly share code, notes, and snippets.

Slow to respond

Ankur Kumar ankurk91

Slow to respond
View GitHub Profile
ankurk91 / power-wordpress-tweaks.php
Last active Mar 26, 2022
Power WordPress Tweaks [Use at your own risk] ⚠️
View power-wordpress-tweaks.php
Plugin Name: Power WP Tweaks
Plugin URI:
Description: Some common tweaks to optimize WP Site
Version: 1.0
Author: ankurk91
Author URI:
License: MIT
ankurk91 / example-virtual-host.ssl.test.conf
Last active Sep 15, 2022
Sample virtual host .conf file for Apache2 on Ubuntu
View example-virtual-host.ssl.test.conf
# This to be used when you need to implement SSL
# Make sure that apache mod_ssl is on
# You can generate self signed certificates for development
<VirtualHost *:443>
ServerName yourapp.test
#ServerAlias www.yourapp.test
ankurk91 /
Last active Jan 3, 2023
Install node-js, npm and yarn on Ubuntu/Mac using nvm
# Install node and npm via nvm -
# Run this script like - bash
# Define versions
ankurk91 / .htaccess
Last active Dec 26, 2022
Some apache .htaccess tips and tricks
View .htaccess
# Source internet
# Use at your own risk, test on localhost first
# Ovrride Default index.php
DirectoryIndex home.php
# Prevent access to some files
<FilesMatch "^(wp-config.php|readme.html|license.txt||.gitignore|.gitattributes|.htaccess|error_log)">
Order allow,deny
Deny from all
ankurk91 /
Last active Oct 11, 2022
Git credential cache, why type password again and again

Tired of entering password again and again ?

Run this command to remember your password:

git config --global credential.helper 'cache --timeout 28800'

Above command will tell git to cache your password for 8 hours.

ankurk91 /
Last active Nov 15, 2021
Useful npm commands and tricks

npm v3.10 -

⚠️ This gist is outdated, but most of the commands are still relevant. ⚠️

Update npm itself

npm install -g npm
# Downgrade to a specific version
npm install -g npm@6
ankurk91 /
Last active Jan 21, 2023
MySQL/Postgresql: Import database via command line

Import large database to MySql

cd /path/to/backups
mysql -u root -h -p --default-character-set=utf8
# Switch to database 
USE database_name;
ankurk91 /
Last active Jan 18, 2023
Ubuntu 22 - PHP development (php 7.4 / 8.2, apache 2.4)
set -euo pipefail
# Ubuntu 20/22 dev Server
# Run like (without sudo) - bash
# Script should auto terminate on errors
export DEBIAN_FRONTEND=noninteractive
ankurk91 /
Last active Jan 22, 2023
php xDebug v3 on Ubuntu/Mac and phpStorm

🪲 Install and Configure xDebug v3 on MacOS for PhpStorm 🐘

  • Assuming that you have already installed php and apache via Homebrew

  • Install xDebug php extension

pecl channel-update
pecl clear-cache

pecl install xdebug
ankurk91 /
Last active Jan 9, 2023
Signing git commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Do you have an Github account ? If not create one.
  • Install required tools
  • Latest Git Client
  • gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with