Skip to content

Instantly share code, notes, and snippets.

Avatar
💤
Slow to respond

Ankur Kumar ankurk91

💤
Slow to respond
View GitHub Profile
@ankurk91
ankurk91 / github_gpg_key.md
Last active February 4, 2023 21:58
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/
@ankurk91
ankurk91 / install_lamp_ubuntu.sh
Last active February 3, 2023 06:47
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 / docker-compose.yml
Last active January 28, 2023 04:47
My docker compose for local development
View docker-compose.yml
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 / laravel_horizon.md
Last active January 27, 2023 21:43
Laravel Horizon, redis-server, supervisord on Ubuntu server
View laravel_horizon.md

Laravel Horizon, redis-server, supervisord on Ubuntu 20/22 server

Laravel 8+, Horizon 5.x, Redis 6+

Parepare application

  • Install and configure Laravel Horizon as instructed in docs
  • Make sure you can access the Horizon dashboard like - http://yourapp.com/horizon
  • For now it should show status as inactive on dashbaord

Install redis-server

@ankurk91
ankurk91 / xdebug-mac.md
Last active January 22, 2023 05:20
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 / import-sql.md
Last active January 21, 2023 16:35
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-node-js.sh
Last active January 3, 2023 14:30
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 / laravel-project.conf
Last active December 28, 2022 06:00
Ngnix conf with php on Ubuntu 20/22
View laravel-project.conf
# /etc/nginx/sites-enabled/laravel.conf
server {
listen 80;
# listen 443 ssl;
# ssl_certificate /etc/nginx/certs/laravel.test.pem;
# ssl_certificate_key /etc/nginx/certs/laravel.test-key.pem;
server_name laravel.test *.laravel.test;
@ankurk91
ankurk91 / .htaccess
Last active December 26, 2022 10:36
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 / bash_profile.md
Last active December 25, 2022 02:48
:octocat: Git branch name in Linux/Mac Bash Terminal
View bash_profile.md

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)/'
}