Skip to content

Instantly share code, notes, and snippets.

View farid-mkh's full-sized avatar
😄

farid mokhtari farid-mkh

😄
View GitHub Profile
@farid-mkh
farid-mkh / github-copilot.md
Last active June 15, 2025 14:39
github copilot tricks
Feature Keyboard Shortcut / Interaction
Autocomplete Code Suggestions Appears automatically as you type code.
Asking Technical Questions Start a comment with Q: followed by your question.
Generating Regular Expressions Describe the desired regex in a code comment.
Generating Unit Tests Describe the function to be tested in a code comment.
SQL Query Suggestions Describe the desired SQL query in a code comment.
Viewing Multiple Solutions Click on the ellipses (...) next to a suggestion, then select "Open GitHub Copilot."
Handling Multiple Conditions Provide multiple conditions within your code comments.
@farid-mkh
farid-mkh / github-classic-token.md
Last active October 27, 2023 21:23
How to clone a repo with github classic token

Github Classic Token

Classic tokens can be used to clone a github repo that needs github authetication

Steps

  1. Generate a classic token from your github setting --> developer setting --> personal access tokens --> Tokens (classic)
  2. In your server, go to a directory you want, then git clone https://{token}@github.com/{username}/{repo}.git
  3. done!

If your token expired, it will ask you for password, You can get this password in github developer setting --> personal access tokens --> Tokens (classic) then you will see that token has expired, when click on the warning message, it will create new token which is the password that the promot wants

@farid-mkh
farid-mkh / node_nginx_ssl.md
Created September 20, 2023 22:00 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@farid-mkh
farid-mkh / vue-fetch-example.vue
Created April 3, 2023 09:44
vue.js - fetch data from api and websocket example
<template>
<div>
<section>
<h2>Vue Component Structure</h2>
<code> {{ '<template> // HTML </template>' }} </code>
<code>
{{ `
<script setup lang="ts">
// Javascript
</script>
@farid-mkh
farid-mkh / git-commands.md
Created January 25, 2023 06:27
useful git commands

Github commands

before push and connect to remote

initialize git for a project

git init
@farid-mkh
farid-mkh / vim.md
Last active December 23, 2022 19:55
vim cheat sheet

vim commands

  1. Open a new or existing file with vim FILE_NAME.
  2. Type i to switch into insert mode so that you can start editing the file. press Esc To get out of insert mode and back to command mode.
  3. :wq - To save and exit your file.
  4. :q! - Quit without first saving the file you were working on
  5. :w - To save file
  6. :e FILE_NAME - open and edit FILE_NAME
  7. /[keyword] - Searches for text in the document where keyword is whatever keyword, phrase or string of characters you're looking for
  8. ?[keyword] - Searches previous text for your keyword, phrase or character string
@farid-mkh
farid-mkh / wordpress-docker.md
Last active June 3, 2024 10:21
Wordpress with docker

How to make wordpress website with wordpress image and mariadb

  1. Create a docker-compose.yaml

From wordpress official image

version: '3.1'

services:

 wordpress:
@farid-mkh
farid-mkh / Intersection-obserber-api
Created November 22, 2022 18:38
An Example shows how to use Intersection Observer API
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Intersection Observer API</title>
<style>
body {
@farid-mkh
farid-mkh / PostgreSQL.md
Created November 4, 2022 17:12
PostgreSQL Commands beside docker image

Set up with docker postgres image

Create a docker container

docker run --name postgres-test -e POSTGRES_PASSWORD=Fast1376 -d postgres -p 5432:5432

Execute postgres commands

@farid-mkh
farid-mkh / docker.md
Last active May 19, 2023 17:59
Docker

Docker basics and details

Docker image

is a file used to execute code in a docker container. Docker images act as a set of instructions to build a Docker container, like a template

Docker Container

is a runnable instance of an image

what is difference between -it and -itd in docker run?

-it run in the console you've typed this and you can see result there