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
| // ---------------------------------------------------------------- 1. API contract | |
| // POST https://api.bazaar-pay.ir/auth/v1/get-access-token/ | |
| // body: {"refresh_token": "<refresh>"} | |
| // 200: {"access_token": "<new access>"} | |
| // 401: refresh token is dead -> user must log in again | |
| data class RefreshRequest(@SerializedName("refresh_token") val refreshToken: String) | |
| data class RefreshResponse(@SerializedName("access_token") val accessToken: String) | |
| interface AuthApi { |
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
| │ Error: error creating security group │ | |
| │ with arvan_security_group.terraform_security_group, | |
| │ on main.tf line 104, in resource "arvan_security_group" "terraform_security_group": | |
| | 104: resource "arvan_security_group" "terraform_security_group" { | |
| │ | |
| │ json: cannot unmarshal bool into Go struct field SecurityGroup.data.readonly of type string | |
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
| resource "arvan_security_group" "terraform_security_group" { | |
| region = var.region | |
| description = "Terraform-created security group" | |
| name = "tf_security_group" | |
| rules = [ | |
| { | |
| direction = "ingress" | |
| protocol = "icmp" | |
| }, | |
| { |
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 | |
| func main() { | |
| counter := 0 | |
| for { | |
| counter++ | |
| } | |
| } |
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
| import random | |
| # Define the number of jobs and their processing times | |
| NUM_JOBS = 5 | |
| processing_times = [10, 6, 8, 7, 3] # Example processing times for each job | |
| # Genetic Algorithm parameters | |
| POPULATION_SIZE = 50 | |
| NUM_GENERATIONS = 100 | |
| CROSSOVER_RATE = 0.8 |
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
| import math | |
| import threading | |
| import tkinter as tk | |
| import numpy as np | |
| from numpy import random | |
| class TravelingSalesmanProblem: | |
| def __init__(self, num_cities): | |
| # Define the number of cities |
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
| import random | |
| import numpy as np | |
| # Define the distance matrix between cities | |
| # In this example, we generate random distances for demonstration purposes | |
| def generate_distance_matrix(num_cities): | |
| distances = np.random.randint(10, 100, size=(num_cities, num_cities)) | |
| np.fill_diagonal(distances, 0) # Diagonal elements are zero | |
| return distances |