SRE this week — 22 Oct 2022
I compile the best of the best things that I come across and share them in my LinkedIn posts.
This week we covered:
- Vscode partial-diff
- Python Dataclasses
- A better way to learn tcpdump
- Book recommendation — Python cookbook
I write about the tools and tips related to Software Development and SRE regularly on my Linkedin profile. You can check out my profile here: https://www.linkedin.com/in/vikasyadav94/
Vscode partial-diff
What if you could select the code snippets and do the diff right from your code editor?
Discovered this wonderful vscode plugin today which lets you do exactly that!
Checkout the partial-diff vscode plugin: https://lnkd.in/eTi7SEgm
- You can compare (diff) text selections within a file, across different files, or to the clipboard.
- It supports User-defined text normalization rules to reduce the noise in the diff (e.g. replace tab characters to spaces)
- Compare text in 2 visible editors (i.e. tabs) with one action.
#vscode
Python Dataclasses
Did you know you can save a lot of time by using dataclass in python?
What are dataclasses?
👉 They are just regular python classes that are made specifically for storing state rather than containing a lot of logic (Although you can add logic to it if you wish to)
👉 With dataclasses you get type hints and basic data validation built in.
👉 Dataclass takes care of a lot of boilerplate code for you — especially useful when your class must be hashable.
👉 It takes care of generating default code for comparison methods ( __lt__ , __gt__)
👉 They provide you hooks to inject custom code after the object is initialized (post_init method)
If you are not happy with the data validation and other features provided by dataclasses and want to get even more — you can try out pydantic — but more on that later.
If you want to explore more, below links might be useful.
-> https://lnkd.in/efq-SV7U
-> https://lnkd.in/e-Q7z_7J
#python #dataclasses #sre
A better way to learn Tcpdump
Want to learn tcpdump? You can either browse through tons of documents for hours or just spend 30 mins on this one.
I have been through a lot of resources to get good with tcpdump — but hands down — there’s nothing better than this.
All credits to the author Julia Evans (https://jvns.ca/) . She’s doing some brilliant job in oversimplifying complex things.
Book Recommendation — Python Cookbook
Looking to get better at Python? Use this book to up your python game!
This book is for experienced python programmers who want to focus on modern tools and idioms related to python. Find complete recipes for more than a dozen topics covering core Python language as well as tasks common to a wide variety of application domains.
Code samples from the book are available here. I highly recommend going through the book and covering components which you find useful: https://lnkd.in/e8JB5sD5
Have other book recommendations related to python? Please share them in the comments section.
#python #bookrecommendation #sre