Skip to content

Instantly share code, notes, and snippets.

View sandeepkv93's full-sized avatar

Sandeep Vishnu sandeepkv93

  • Snowflake
  • Bellevue, WA
  • 17:22 (UTC -07:00)
View GitHub Profile
@sandeepkv93
sandeepkv93 / settings.json
Created December 6, 2023 10:56
VSCode User Settings
{
"workbench.startupEditor": "newUntitledFile",
"editor.suggestSelection": "first",
"editor.rulers": [160],
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
@sandeepkv93
sandeepkv93 / RESTvsGraphQLvsGRPC.md
Last active August 4, 2023 12:31
When to use REST, GraphQL and gRPC?

REST (Representational State Transfer)

REST is a standard for designing networked applications. It uses HTTP methods to implement the concept of CRUD (Create, Read, Update, Delete).

When to use REST:

  1. Public APIs for third-party developers : REST is widely adopted and understood by many developers, making it a good choice for public APIs.
  2. Microservices with HTTP/JSON : If your microservices are lightweight and primarily use HTTP/JSON, REST can be a good choice.
  3. Stateless operations : REST is stateless, meaning each HTTP request happens in complete isolation. When the client makes an HTTP request, it includes all information necessary for the server to fulfill that request.
  4. Cacheable data : If your application serves data that can be cached to improve performance, REST can be a good choice because HTTP supports caching out of the box.
  5. Web applications : REST is a good fit for web applications, especially when combined with JavaScript frameworks like Angular or Reac
@sandeepkv93
sandeepkv93 / yt-dlp.md
Created October 30, 2022 16:19
Download a Youtube Playlist using yt-dlp with numbering prefix on each videos
.\yt-dlp.exe --cookies .\youtube.com_cookies.txt -f "mp4" -o "%(playlist_index)s-%(title)s.%(ext)s"
@sandeepkv93
sandeepkv93 / windows-invm-notification.ps1
Created May 7, 2020 05:04
Windows Powershell script for InVM Notification using Azure Metadata Service
# 1. RDP into the VM
# 2. Open PowerShell in Administrator Mode.
# 3. Run the command ‘Set-ExecutionPolicy Unrestricted’.
# 4. Create a powershell script called ‘windows-invm-notification.ps1’ and copy the following content in the file.
DO
{
Invoke-WebRequest http://169.254.169.254/metadata/scheduledevents?api-version=2019-01-01 -H @{"Metadata"="true"};
Start-sleep -Seconds 2;
} While ($true)
@sandeepkv93
sandeepkv93 / invm-notification.sh
Last active May 7, 2020 02:18
Azure Invm Scheduled Events notification for Linux VMs
#!/bin/bash
while true
do
echo " Press [CTRL+C] to stop.."
curl -H Metadata:true "http://169.254.169.254/metadata/scheduledevents?api-version=2019-01-01"
sleep 2
done

Pull a docker image

docker pull <image_name>

Run a docker image with a start command

docker run -it <image_id> commad
example: docker run -it <image_id> /bin/bash
@sandeepkv93
sandeepkv93 / flask_heroku_guide.md
Created November 27, 2018 00:29
Creating Flask App and deploying it in Heroku

Creating Flask App and deploying it in Heroku

Create a Flask App

  1. Create a virtual environment
    • In Windows
    virtualenv env
    cd env\Scripts
    .\activate
@sandeepkv93
sandeepkv93 / alembic_guide.md
Created September 12, 2018 18:44
Alembic Usage Guide

Initialize

alembic init alembic

Setup

1. Set sqlalchemy.url in alembic.ini
2. Set target_metadata to proper models.py's model in env.py