Chapi Dev Talks
To clarify this more in a simple python code. This does resembles the actual code by just waiting yet the same thing happens in real codes too. #asyncio part 2
Good Scenarios for Async Programming
There are many scenarios that we can leverage async programming to our work flow and i want to mention some of them.
Backend Services
- Notifying users is a really good choice if you can make it async. Ex: Sending emails, sending push notifications, etc.
- Processing data in the background. Ex: Processing a large file, processing a large amount of data, etc.
- Long running task operation that can be done in the background. Ex: Generating reports, etc.
Example in Action
What we make here is, we are accepting a csv file and add the process to be processed in the background yet the user don't have to wait for that request to be the task completed. We can also check the status of the process by using the process id.
If the above were async, the user would have to wait for the process to be completed and that would be a bad user experience.
#asyncio part 3
There are many scenarios that we can leverage async programming to our work flow and i want to mention some of them.
Backend Services
- Notifying users is a really good choice if you can make it async. Ex: Sending emails, sending push notifications, etc.
- Processing data in the background. Ex: Processing a large file, processing a large amount of data, etc.
- Long running task operation that can be done in the background. Ex: Generating reports, etc.
Example in Action
# Accepting CSV file and processing it in the background
from fastapi import FastAPI, File, UploadFile, BackgroundTasks
import asyncio
app = FastAPI()
process_status = {} # use database in production
async def process_id_generator():
...
async def process_csv(process_id: int, file: UploadFile):
# Do some processing
await asyncio.sleep(5)
process_status[process_id] = "success"
return
@app.post("/upload")
async def upload_file(file: UploadFile = File(...)):
asyncio.create_task(process_csv(file))
return {"status": "processing"}
# this uses fastapi background task scheduler to process
@app.post("/upload-fast-bg")
async def upload_file_fast_bg(file: UploadFile = File(...) , background_tasks: BackgroundTasks):
process_id = await process_id_generator()
background_tasks.add_task(process_csv, process_id, file)
return {"status": "pending", "process_id": process_id}
@app.post("process-status/{process_id}")
async def process_status(process_id: int):
return {"status": process_status.get(process_id, "not found")}
What we make here is, we are accepting a csv file and add the process to be processed in the background yet the user don't have to wait for that request to be the task completed. We can also check the status of the process by using the process id.
If the above were async, the user would have to wait for the process to be completed and that would be a bad user experience.
#asyncio part 3
I was working reading more about how DNS Resolve works and that shit is so annoying, so far i only knows how to resolve the domain using
A Query π
This can resolve the domain or not
RFC: DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION
A Query π
import socket
import struct
def dns_resolver(domain_name):
# DNS server (Google's Public DNS)
dns_server = '8.8.8.8'
dns_port = 53
# Create a UDP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Pack the DNS query
query = build_dns_query(domain_name)
# Send the DNS query to the DNS server
sock.sendto(query, (dns_server, dns_port))
# Receive the DNS response
response, _ = sock.recvfrom(1024)
print('response', response, _)
# Parse the DNS response
ip_address = parse_dns_response(response)
return ip_address
def build_dns_query(domain_name):
# DNS header
header = struct.pack('!HBBHHHH', 0, 1, 0, 1, 0, 0, 0)
# DNS question section
question = b''
for part in domain_name.split('.'):
question += struct.pack('!B', len(part))
question += part.encode('utf-8')
question += b'\x00' # End of domain name
question += struct.pack('!H', 1) # Query type A (IPv4)
question += struct.pack('!H', 1) # Class IN (Internet)
return header + question
def parse_dns_response(response):
# Parse the response to extract the IP address
ip_address = '.'.join(str(byte) for byte in response[-4:])
return ip_address
# Example usage
domain_name = 'blog.chapimenge.com'
ip_address = dns_resolver(domain_name)
print(f'The IP address of {domain_name} is {ip_address}')
This can resolve the domain or not
RFC: DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION
If you really wanna found out a website all his subdomain this tool might be really amazing
Requirements:
- Go
if the last command give you an error like the subfinder command not found use the below command for quick fix
for long term fix just add the
This project is from Project Discovery which is amazing org that have a lot of project you can use for recon(specially on bug bounty)
I hope you like it and if you have any question comment it and we can get it work for you.
Requirements:
- Go
go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest
go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
subfinder -d example.com --silent | ~/go/bin/httpx --silent -sc --title
if the last command give you an error like the subfinder command not found use the below command for quick fix
~/go/bin/subfinder -d example.com --silent | ~/go/bin/httpx --silent -sc --title
for long term fix just add the
~/go/bin to your PATH variable in your .bashrc file like below PATH=$PATH:~/go/bin
This project is from Project Discovery which is amazing org that have a lot of project you can use for recon(specially on bug bounty)
I hope you like it and if you have any question comment it and we can get it work for you.
π5
You won't belive what i found π
I found that in one of the big company i found their development server and found their new ai chat bot in development mode π
DAMN PEOPLE
I found that in one of the big company i found their development server and found their new ai chat bot in development mode π
DAMN PEOPLE
π8π2π1
Good Morning My people,
Just finished reading the openai article about elun musk.
https://openai.com/blog/openai-elon-musk
Thank you Dagmawi for posting this article.
My opinion is as much as elun musk have a point on how openai might cheat the system by avoiding huge chunks of tax they have legismate reason to not disclose their science.
But what I really admire Elun on this is he makes twitter algorithm open sourced and nothing happens to twitter this is how he thinks.
People have different perspectives let alone in a large scale we constantly fight with in a small groups of people.
At the end of the day either you be the big player or you take what you can from the fight π.
Personally I am enjoying and using what I can as much as possible.
You don't have to live to make everyone happy like you see openai couldn't even make Elun musk happy π.
Have a delightful day π.
Just finished reading the openai article about elun musk.
https://openai.com/blog/openai-elon-musk
Thank you Dagmawi for posting this article.
My opinion is as much as elun musk have a point on how openai might cheat the system by avoiding huge chunks of tax they have legismate reason to not disclose their science.
But what I really admire Elun on this is he makes twitter algorithm open sourced and nothing happens to twitter this is how he thinks.
People have different perspectives let alone in a large scale we constantly fight with in a small groups of people.
At the end of the day either you be the big player or you take what you can from the fight π.
Personally I am enjoying and using what I can as much as possible.
You don't have to live to make everyone happy like you see openai couldn't even make Elun musk happy π.
Have a delightful day π.
Openai
OpenAI and Elon Musk
We are dedicated to the OpenAI mission and have pursued it every step of the way.
π4
This is too funny 10 years ago people were shitting on NodeJs π.
This video is from years back https://youtu.be/5lJXb-yym0Y
This video is from years back https://youtu.be/5lJXb-yym0Y
π3π1
Is the
If you don't know what CPU bound and Io bound is in short
CPU Bound - is something that use cpu intensively something like factorials which keeps calculating the value it doesn't depend on any other resources.
IO Bound - is something that waits for other resources to finish like you sending requiest to database server to get the data.
This is a very high level explanation for you to understand it.
Now when you do
time.sleep CPU bound or Io bound? If you don't know what CPU bound and Io bound is in short
CPU Bound - is something that use cpu intensively something like factorials which keeps calculating the value it doesn't depend on any other resources.
IO Bound - is something that waits for other resources to finish like you sending requiest to database server to get the data.
This is a very high level explanation for you to understand it.
Now when you do
time.sleep(10) is it IO bound or CPU bound task?β€1
Forwarded from Pavel Durov (Pavel Durov)
Thatβs just the start β we are shipping more Telegram Business features this month. One of these features will revolutionize how people interact with chatbots. Telegram Business accounts will be able to seamlessly add chatbots as their invisible secretaries to respond to all or certain chats. With AI, these chatbots can bring customer service automation to an entirely new level.
The new Bot APIs for developers will become available later this month, all for free. Stay tuned β more exciting stuff is coming for businesses and developers on Telegram this season.
Please open Telegram to view this post
VIEW IN TELEGRAM
π7β€6β‘1
This media is not supported in your browser
VIEW IN TELEGRAM
The earth when you code using
Python JavaScript ....
Python JavaScript ....
π13π€£6
In progress project.
You will me a website i give you the source code!
NextJS Tailwind ShadCN V0
You will me a website i give you the source code!
[Github] is under active developmentNextJS Tailwind ShadCN V0
β€13π4β‘3π1
Loglib is on fire people.
@beka_cru and the team keep this energy flowing.
https://t.me/loglib_community
@beka_cru and the team keep this energy flowing.
https://t.me/loglib_community
β‘14π4β€2π1
How do you debug 405 Method not allowed error on Vercel?
Am having a nasty error ππππ.
I am logging in my server actions and Vercel is just playing with me.
They showed me the log that I don't want.
Any recommendations?
It works on my local setup my guess is on the server actions there is some blocking happening since I am requesting third-party endpoint.
Am having a nasty error ππππ.
I am logging in my server actions and Vercel is just playing with me.
They showed me the log that I don't want.
Any recommendations?
It works on my local setup my guess is on the server actions there is some blocking happening since I am requesting third-party endpoint.
π1
Do you know you can use underscore to increase readability of your code while writing numbes?
In programs like python and golang this can be used to have more readable code.
In Python
I don't know if it is possible in another languages but I would love to hear from you all if you know any.
In programs like python and golang this can be used to have more readable code.
In Python
large_num = 1_000_000In Golang
package mainUse this info to make your code more readable.
func main(){
largeNum := 1_000_000
}
I don't know if it is possible in another languages but I would love to hear from you all if you know any.
β9π3π2β‘1π1π₯1
People really need to understand billionaires and millionaires difference.
If I give you 100k$ every day you need 10 days to be a millionaire.
If I give you 100k$ every day you need at least 27 years to be a billionaire.
Let that sink in.
FYI: with the above rate to reach Elun musk you need >540 years to reach his worth π
If I give you 100k$ every day you need 10 days to be a millionaire.
If I give you 100k$ every day you need at least 27 years to be a billionaire.
Let that sink in.
FYI: with the above rate to reach Elun musk you need >540 years to reach his worth π
π€―13π3π€2π1