Skip to content

Instantly share code, notes, and snippets.

@majidalaeinia
majidalaeinia / terminal_font_issue_with_zsh.md
Last active February 9, 2025 15:09
Resolve Terminal Font Issue with ZSH
@majidalaeinia
majidalaeinia / set_shecan_or_back_to_normal_dns.md
Last active February 5, 2025 11:24
Swap to shecan.ir DNS easier in one command

Usage

Set shecan DNS:

setsh

Set your normal DNS:

setn
@majidalaeinia
majidalaeinia / connect_to_remote_database_from_dockerized_localhost.md
Last active February 10, 2025 21:15
Connect to Remote Database from Dockerized Localhost

Suppose you have such ssh config:

Host folan_server
  Port 22
  User root
  ForwardAgent yes
  ProxyCommand ssh -A -p 22 [email protected] -W y.y.y.y:22
@majidalaeinia
majidalaeinia / convert_gregorian_date_to_jalali_date.md
Last active November 30, 2024 12:20
Convert Gregorian Date to Jalali (Shamsi - Persian) Date in Postgresql

Add Persian Calendar Functions to a Postgres Database

Here's the Ruby on Rails migration implementation:

class AddPersianCalendarFunctionsToDb < ActiveRecord::Migration[4.2]
  def up
    execute(
      <<-EOSQL
      DROP FUNCTION IF EXISTS startOfJalaaliMonth(timestamp);
@majidalaeinia
majidalaeinia / vscode_intellij_shortcuts.md
Last active February 12, 2025 17:06
VS Code Intellij Shortcuts
IntelliJ VS Code Description
Alt+1 Ctrl+Shift+E / Ctrl+B
Alt+Shift+1 F1 -> reveal -> Enter
Double Shift Ctrl+P
Alt+F12 Ctrl+`
Alt+Ctrl+S Ctrl+,
Settings -> Key Bindings Ctrl+K Ctrl+S
Settings -> Extensions Ctrl+Shift+X
Ctrl+K Ctrl+Shift+G
@majidalaeinia
majidalaeinia / cron_intellij_errrors.md
Created January 10, 2023 23:36
Cronjob to Remove IntelliJ Errors
0 */3 * * * '/usr/bin/rm /home/majid/java_error_in_idea_*.log' >> /tmp/cron_remove_java_error_in_idea.log 2>&1
0 */3 * * * '/usr/bin/rm /home/majid/replay_pid*.log' >> /tmp/cron_remove_replay_pid.log 2>&1
@majidalaeinia
majidalaeinia / nginx.md
Created January 22, 2022 18:36
nginx.md

Nginx

Global Context

// nginx.conf
http {
    upstream {
    }
    server {
        location {
@majidalaeinia
majidalaeinia / vim_nginx_syntax_highlighting.sh
Last active January 21, 2022 23:09
Enable Vim Syntax Highlighting for NGINX Files
mkdir -p ~/.vim/syntax/
wget https://www.vim.org/scripts/download_script.php?src_id=27919 -O ~/.vim/syntax/nginx.vim
cat > ~/.vim/filetype.vim <<EOF
au BufRead,BufNewFile /etc/nginx/*,/etc/nginx/conf.d/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif
EOF

Installing Xdebug on Intellij

  • OS: Linux (Ubunutu)
  • IDE: Intellij
  1. Find your current php version:
php -v

The result will be like X.Y.Z.