Read the original blog on dev.to
Mypy is a static type checker for Python. It acts as a linter, that allows you to write statically typed code, and verify the soundness of your types.
All mypy does is check your type hints. It’s not like TypeScript, which needs to be compiled before it can work. All mypy code is valid Python.
This gives us the advantage of having types, as you can know for certain that there is no type-mismatch in your code, just as you can in typed, compiled languages like C++ and Java, but you also get the…
Read the original on dev.to
I’ve been practicing my Data Structures and Algorithms on LeetCode for a few months now, and it’s an awesome platform. The quality of the questions is generally great, there’s very nice explanations for most of the solutions, and there’s a very motivated and active community around all of it. Overall, LeetCode is a great platform.
BUT, I had two slight problems with it:
So someone at Google released a tool called zx a couple days ago, and…
Well, take a look at it for yourself:
I can’t be the only one who hates:
await $`...`syntax used for every. single. command.
And I thought I could do better, so I tried. And this is what I came up with:
#! /usr/bin/env zxpy
~'echo Hello world!'file_count = ~'ls -1 | wc -l'
print("file count is:", file_count)
It fixes the two problems I had in…
I’m a huge fan of Python. It’s by far the simplest general purpose language, that you can just pick up and start building amazing things with.
So I went out to find if Python has such an equivalent, and sure enough, there was.
It’s called mypy, and it…
This guide is here just because I’ve messed up the installs on arch before, and turns out it’s actually pretty easy to do.
sudo pacman -S yay
yay postgresql pgadmin4
This should automatically setup your postgres user and group.
sudo -u postgres -i # login as postgres
initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data/'
exitsudo systemctl enable --now postgresql
sudo systemctl status postgresql # to check for any errors
psql -U postgrespostgres=# \password # to set password
$ su# cd /var/lib/postgres/data
# cp pg_hba.conf pg_hba.conf.backup # in case you mess up
# nano pg_hba.conf
Your default pg_hba.conf…
Original Post on dev.to
P.S. if you’re in a hurry, find the correct solution here
I was working on a full stack side project a few months ago, and I wanted to make API requests from my android app to my desktop, and for some reason
localhost:8000 wasn't simply accessible by my phone.
Well, understandable, I know that every device’s localhost is independent and cannot be accessed by your home network (your Wi-Fi, for example). So the localhost on my laptop won’t be able to access the localhost on my phone.
So, I asked Google for help. And I got…
URL shorteners are great. You can take a long URL and make it 6–8 characters, you know the drill.
And the free URL shorteners are pretty nice too! bit.ly is what I used, and it did its job pretty well, but free public shorteners have a few issues:
So, Flutter. Flutter is a cross-platform mobile SDK, which allows you to build android as well as iOS apps from the same codebase. The apps are light, performant and run natively on both devices. Pretty cool, right?
This post will guide you through some of the basics of Flutter while making a simple Login page. This post does assume you have flutter installed and you’ve made a fresh project. So let’s dive right in.
Everything in flutter is going to be a widget. From windows to text boxes, down to the themes and padding. …
i write code