Skip to content

Instantly share code, notes, and snippets.

View majidalaeinia's full-sized avatar
🎯
Focusing

Majid Alaeinia majidalaeinia

🎯
Focusing
View GitHub Profile
@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.

@majidalaeinia
majidalaeinia / git_revert_file_permissions.md
Created October 9, 2021 07:59
Git Revert File Permissions

Git Revert File Permissions

git diff -p \
    | grep -E '^(diff|old mode|new mode)' \
    | sed -e 's/^old/NEW/;s/^new/old/;s/^NEW/new/' \
    | git apply
@majidalaeinia
majidalaeinia / resolve_google_meet_black_screen_on_share_entire_screen.md
Last active September 17, 2021 21:01
Resolve Google Meet Black Screen on Share Entire Screen
@majidalaeinia
majidalaeinia / php_extension_best_way.md
Created September 12, 2021 07:19
PHP Extension Installation

PHP Extension Installation

  1. sudo apt install php-[ext_name] or sudo pecl install [ext_name].
  2. cd /etc/php/7.4/mods-available and ls to see if the [ext_name].so is available there.
  3. If it's available, then add extension=[ext_name].so; to the php.ini file and then sudo systemctl restart php7.4-fpm.service.
  4. Check php -m | grep [ext_name] to see if it has been installed.
  5. IF NOT: php -i | grep extension_dir and then cd to the path of the returned extension dir.
  6. The [ext_name].so file must be on this path. Copy it to the /etc/php/7.4/mods-available folder and jump to step 2.
@majidalaeinia
majidalaeinia / curl_useful_commands.md
Created September 5, 2021 12:20
Curl Useful Commands

Curl Useful Commands

1. Get the HTTP response status code

curl -s -o /dev/null -w "%{http_code}\n" -XGET 0.0.0.0:23080

The result will be the HTTP status code:

200
@majidalaeinia
majidalaeinia / private_php_package_the_neatest_way.md
Last active August 24, 2021 04:13
Private PHP Package: The Neatest Way

On the package

  1. Add a tag (version: e.g. 1.0.0)
  2. Adding the minimum_stability for our package on its composer.json file:
{
  ...
  "minimum-stability": "stable",
  ...
}