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 / 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 / postgresql-ubuntu.md
Last active March 27, 2023 01:57
PostgreSQL Database on Ubuntu 20

PostgreSQL on Ubuntu

⚠️ I would rather recommand to install PostgreSQL inside docker.

Add PPA Source

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
@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
*/
@ankurk91
ankurk91 / docker-compose.yml
Last active August 10, 2023 09:12
My docker compose for local development
version: "3"
services:
postgres15:
image: 'nickblah/postgis:15-postgis-3'
container_name: postgres-15
restart: unless-stopped
ports:
- "${FORWARD_PGSQL_PORT:-5432}:5432"
volumes:
@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 / dnsmasq.md
Last active October 22, 2023 11:50
DNSmasq on Ubuntu 18/20

DNSmasq wildcard on Ubuntu 18/20

  • Install dnsmasq
sudo apt install -y dnsmasq
sudo apt install -y resolvconf
  • 💡 The dnsmasq service will fail to start, you can ignore those errors for timebeing
  • Disable the default systemd-resolved service
@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 / bash_profile.md
Last active October 22, 2023 12:16
:octocat: Git branch name in Linux/Mac Bash Terminal

Mac OS : Show your git branch name on your bash terminal

⚠️ Does not work in zsh terminal

Add these lines in your ~/.bash_profile file

# Show current git branch name
parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
@ankurk91
ankurk91 / phpstorm-install.sh
Last active November 1, 2023 04:23
Install Postman, PhpStorm on Ubuntu Linux (no snaps)
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Run this script without sudo
# bash script_name.sh
INSTALL_TMP_DIR=~/phpstorm-tmp
mkdir -p $INSTALL_TMP_DIR
@ankurk91
ankurk91 / 1-elementary-os-apps.md
Last active December 25, 2023 19:14
elementary OS 5.1 Hera

elementaryOS Apps and Configs

⚠️ No longer maintained! ⚠️

This guide has been updated for elementaryOS v5.0+.

Enbale PPA support

sudo apt-get update
sudo apt-get -y install software-properties-common