Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
سوپرمن میخوان یا برنامه نویس؟؟؟
In order to checkout all files in a project in GIT:

git checkout -- .


#git #checkout
Forwarded from Quera
🔹مسابقاتِ برنامه‌نویسیِ Backend و Frontend تومن

در این مسابقه سوالاتِ🔹بک‌اند، Python و Django و 🔹فرانت‌اند Front-End و Reactjs‌ می‌باشد.

👈علاقه‌مندان میتوانند به صورت مجزا در این دو مسابقه شرکت کنند.
🔹همراه با ۳ میلیون جایزه نقدی

☝️از نفرات برتر این مسابقه جهت استخدام در شرکت تومن دعوت به عمل می‌آید.
زمان مسابقه: ۲۱ تیرماه روز جمعه

ثبت‌نام از در این مسابقه از طریق:👇
🔹https://quera.ir/r/dpi1h

@Quera_ir
Did you know that python print command takes sep argument as a separator between string arguments?

print('ali', 'reza', sep=', ') # output: ali, reza


#python #print #sep #separator
ghz:
- Simple gRPC benchmarking and load testing tool inspired by hey and grpcurl.

sample ghz command to load test a service:

ghz --insecure --proto my_proto.proto --call my_proto.AService.MethodById -d '{"user_id": "5d32b19b6fea7a28de186b15"}' 0.0.0.0:9000


The sample output will be:

Summary:
Count: 200
Total: 557.11 ms
Slowest: 319.18 ms
Fastest: 33.30 ms
Average: 132.56 ms
Requests/sec: 358.99

Response time histogram:
33.300 [1] |
61.887 [6] |∎∎
90.475 [98] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
119.062 [23] |∎∎∎∎∎∎∎∎∎
147.650 [12] |∎∎∎∎∎
176.238 [10] |∎∎∎∎
204.825 [7] |∎∎∎
233.413 [12] |∎∎∎∎∎
262.000 [9] |∎∎∎∎
290.588 [9] |∎∎∎∎
319.176 [13] |∎∎∎∎∎

Latency distribution:
10% in 70.25 ms
25% in 83.84 ms
50% in 89.90 ms
75% in 178.51 ms
90% in 275.84 ms
95% in 301.41 ms
99% in 317.01 ms

Status code distribution:
[OK] 200 responses


#grpc #loadtest #ghz #grpcurl #hey #proto
How tom remove dangling volumes in docker?

docker volume rm $(docker volume ls -qf dangling=true)


#docker #linux #dangling
os.Rename in goLang?

Function signature:

func Rename(oldpath, newpath string) error


What Rename does?

Rename renames (moves) oldpath to newpath. If newpath already exists and is not a directory, Rename replaces it. OS-specific restrictions may apply when oldpath and newpath are in different directories. If there is an error, it will be of type *LinkError.

#golang #go #os #rename #os_rename
🛑 Guys from now on you may hear more about Golang than Python for few months ahead. :)
As you may already know in Python you can format your string using format as below:

file_name = "/root/openvpn/{}.ovpn".format(my_file_name)
// Or
file_name = "/root/openvpn/%s.ovpn" % my_file_name



In golang you need to use Sprintf method of fmt package like follow:

var fileName = fmt.Sprintf("/root/openvpn/%s.ovpn", myFileName)


#python #golang #go #fmt #sprintf #format
Echo: High performance, minimalist Go web framework
- https://echo.labstack.com
- https://github.com/labstack/echo

A sample hello-world web server using Echo:

package main

import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)

func main() {
// Echo instance
e := echo.New()

// Middleware
e.Use(middleware.Logger())
e.Use(middleware.Recover())

// Routes
e.GET("/", hello)

// Start server
e.Logger.Fatal(e.Start(":1323"))
}

// Handler
func hello(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
}