Skip to content

Instantly share code, notes, and snippets.

View ankurk91's full-sized avatar
⛈️
Moving to Cloud

Ankur K ankurk91

⛈️
Moving to Cloud
View GitHub Profile
@ankurk91
ankurk91 / xdebug-mac.md
Last active March 9, 2024 22:20
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.php.net
pecl clear-cache

pecl install xdebug
@ankurk91
ankurk91 / install_lamp_ubuntu.sh
Last active January 23, 2025 04:13
Ubuntu 22/24 - PHP development (php 7.4 / 8.4, apache 2.4)
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Ubuntu Server
export DEBIAN_FRONTEND=noninteractive
echo -e "\e[96m Adding PPA \e[39m"
sudo add-apt-repository -y ppa:ondrej/apache2
@ankurk91
ankurk91 / import-sql.md
Last active February 20, 2025 05:52
MySQL/Postgresql/Mongo: Import database via command line

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 / npm-commands.md
Last active October 22, 2023 12:16
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
ankurk91 / git_remember_password.md
Last active March 24, 2025 03:03
Git credential cache, why type password again and again

Tired of entering passwords 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 / .htaccess
Last active March 24, 2025 20:00
Some apache .htaccess tips and tricks
# 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 / install-node-js.sh
Last active November 4, 2024 05:29
Install node-js, npm and yarn on Ubuntu/Mac using nvm
#!/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=22
INSTALL_NVM_VER=0.40.1
@ankurk91
ankurk91 / example-virtual-host.ssl.test.conf
Last active December 24, 2024 23:13
Sample virtual host .conf file for Apache2 on Ubuntu
# 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 / power-wordpress-tweaks.php
Last active October 9, 2024 00:37
Power WordPress Tweaks [Use at your own risk] ⚠️
<?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
*/