Skip to content

Instantly share code, notes, and snippets.

Avatar
💤
Slow to respond

Ankur Kumar ankurk91

💤
Slow to respond
View GitHub Profile
@ankurk91
ankurk91 / power-wordpress-tweaks.php
Last active Mar 26, 2022
Power WordPress Tweaks [Use at your own risk] ⚠️
View power-wordpress-tweaks.php
<?php
/*
Plugin Name: Power WP Tweaks
Plugin URI: http://ankurk91.github.io/
Description: Some common tweaks to optimize WP Site
Version: 1.0
Author: ankurk91
Author URI: http://ankurk91.github.io/
License: MIT
*/
@ankurk91
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
# http://www.selfsignedcertificate.com/
<VirtualHost *:443>
ServerName yourapp.test
#ServerAlias www.yourapp.test
@ankurk91
ankurk91 / install-node-js.sh
Last active Jan 3, 2023
Install node-js, npm and yarn on Ubuntu/Mac using nvm
View install-node-js.sh
#!/bin/sh
# Install node and npm via nvm - https://github.com/nvm-sh/nvm
# Run this script like - bash script-name.sh
# Define versions
INSTALL_NODE_VER=18
INSTALL_NVM_VER=0.39.3
@ankurk91
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|README.md|.gitignore|.gitattributes|.htaccess|error_log)">
Order allow,deny
Deny from all
@ankurk91
ankurk91 / git_remember_password.md
Last active Oct 11, 2022
Git credential cache, why type password again and again
View git_remember_password.md

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
ankurk91 / npm-commands.md
Last active Nov 15, 2021
Useful npm commands and tricks
View npm-commands.md

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
ankurk91 / import-sql.md
Last active Jan 21, 2023
MySQL/Postgresql: Import database via command line
View import-sql.md

Import large database to MySql

cd /path/to/backups
mysql -u root -h 127.0.0.1 -p --default-character-set=utf8
# Switch to database 
USE database_name;
@ankurk91
ankurk91 / install_lamp_ubuntu.sh
Last active Jan 18, 2023
Ubuntu 22 - PHP development (php 7.4 / 8.2, apache 2.4)
View install_lamp_ubuntu.sh
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Ubuntu 20/22 dev Server
# Run like (without sudo) - bash install_lamp.sh
# Script should auto terminate on errors
export DEBIAN_FRONTEND=noninteractive
@ankurk91
ankurk91 / xdebug-mac.md
Last active Jan 22, 2023
php xDebug v3 on Ubuntu/Mac and phpStorm
View xdebug-mac.md

🪲 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.php.net
pecl clear-cache

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

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 https://brew.sh/