Skip to content

Instantly share code, notes, and snippets.

View rahul-yr's full-sized avatar

Rahul Reddy rahul-yr

View GitHub Profile
git clone url
git fetch
git branch
git pull
git status
CRLF to LF
git config core.autocrlf false
import pyautogui
import time
while True:
try:
pyautogui.moveTo(20, 20, duration=1)
time.sleep(1)
pyautogui.moveTo(1000, 20, duration=1)
time.sleep(1)
@rahul-yr
rahul-yr / docker-compose.yaml
Created April 2, 2022 06:55
Docker compose file for Mongodb with UI
version: '3.9'
services:
mongo:
container_name: myapp-mongo
image: mongo
restart: always
ports:
- "27017:27017"
@rahul-yr
rahul-yr / gist:2a620f151d193e53f0f24ba05d7ba5ac
Last active April 21, 2022 03:09
This is Short notes for Go Commands
go mod init github.com/rahul-yr/auth-service
go mod tidy
go install
go run .
go clean -modcache
go get package-url
go test
go test -v
go test ./...
@rahul-yr
rahul-yr / go-http-chain-middlewares.go
Created May 26, 2022 07:39
Go HTTP chain middlewares
package main
import (
"fmt"
"log"
"net/http"
"time"
)
type CustomMiddlewares func(http.HandlerFunc) http.HandlerFunc
@rahul-yr
rahul-yr / non_thread_safe.go
Created June 11, 2022 12:36
Go Singleton pattern implementation
package main
import (
"log"
"sync"
"time"
)
// This is struct for mocking the connection.
type SQLConnection struct {
@rahul-yr
rahul-yr / thread_safe.go
Created June 11, 2022 12:41
Go Singleton pattern implementation
package main
import (
"log"
"sync"
"time"
)
// This is struct for mocking the connection.
type SQLConnection struct {
@rahul-yr
rahul-yr / Procfile
Last active June 12, 2022 12:24
This is a file with commands for performing deployment to heroku
web : app-name
@rahul-yr
rahul-yr / fastapi-sample-main.py
Created June 15, 2022 08:27
This is a sample fast api code
from fastapi import FastAPI
from url_shortener import router
# Create the app
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@rahul-yr
rahul-yr / models.py
Created June 15, 2022 09:42
Here I defined all the required methods for url_shorteners
from pydantic import BaseModel
# Define the model for the URL
class CreateUrlShortener(BaseModel):
url: str
# Config for pydantic to validate the data in the request body
class Config:
orm_mode = True
# Define the model for the URL Response