This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scrapy import crawler | |
from scrapy.utils.project import get_project_settings | |
# pip install crochet | |
from crochet import setup as crochet_setup, run_in_reactor | |
crochet_setup() | |
runner = crawler.CrawlerRunner(get_project_settings()) | |
@run_in_reactor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Written by Arsham Arya | |
Some snippets around pymongo package to prevent my confusion. | |
""" | |
from pymongo import MongoClient | |
# Initializing | |
client = MongoClient("mongodb://username:password@host:port/default_db?authSource=admin") | |
database = client.get_database("db_name") | |
collection = database.get_collection("collection_name") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Improvement after each stage: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o4htns2axmh87lieoclw.png | |
# Resource 1 => https://simplernerd.com/docker-typescript-production/ | |
# Resource 2 => https://medium.com/@ankit.wal/the-why-and-how-of-multi-stage-docker-build-with-typescript-example-bcadbce2686c | |
FROM node:18-alpine3.15 as ts-compiler | |
WORKDIR /usr/app | |
COPY package*.json ./ | |
COPY tsconfig.json ./ | |
RUN npm install --include=dev | |
COPY src src | |
RUN ["npm", "run", "build"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
func main() { | |
myJson := map[string]interface{}{ | |
"name": "Arsham", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"math" | |
"net/http" | |
// go get "github.com/gorilla/mux" | |
"github.com/gorilla/mux" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI | |
from fastapi.middleware.cors import CORSMiddleware | |
from fastapi.staticfiles import StaticFiles | |
from routes import routes_group_1, routes_group_2 | |
api_app = FastAPI(title="api app") | |
api_app.add_middleware( | |
CORSMiddleware, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your key bindings in this file to override the defaultsauto[] | |
[ | |
{ | |
"key": "cmd+b", | |
"command": "workbench.action.terminal.clear", | |
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" | |
}, | |
{ | |
"key": "cmd+k", | |
"command": "-workbench.action.terminal.clear", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
"github.com/golang-jwt/jwt" | |
) | |
func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.21-alpine3.18 AS builder | |
WORKDIR /app | |
COPY go.mod go.sum ./ | |
RUN go mod download | |
COPY . ./ | |
RUN CGO_ENABLED=0 GOOS=linux go build -a -o main . | |
FROM node:18-alpine3.15 AS frontend | |
WORKDIR /ui | |
COPY ui . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
const ( | |
msg_welcome string = ` | |
Welcome to Dockeroller! |