Skip to content

Instantly share code, notes, and snippets.

View ankurk91's full-sized avatar
💤
Slow to respond

Ankur K ankurk91

💤
Slow to respond
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 February 29, 2024 04:17
Ubuntu 22 - PHP development (php 7.4 / 8.2, apache 2.4)
#!/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 / import-sql.md
Last active October 15, 2023 03:50
MySQL/Postgresql: 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 October 11, 2022 04:57
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
ankurk91 / .htaccess
Last active January 17, 2024 18:45
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 October 22, 2023 12:25
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=18
INSTALL_NVM_VER=0.39.3
@ankurk91
ankurk91 / example-virtual-host.ssl.test.conf
Last active March 13, 2024 03:53
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 May 9, 2023 10:36
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
*/