in python3

When diving into web scraping in python, the choice is inevitably between two libraries: beautifulsoup and selenium.
While beautifulsoup is quite practical to break down html pages, selenium, being a headless driver, can do this and much more: it can type search queries into google, scrape js scripts, loops through pages one by one, etc.

Moreover, it turns useful when web pages load content only upon scrolling.
Loading content upon scrolling speeds up the page loading time and offers a best user experience. But it is also have web scrapers get many headaches.
Here’s a solution.

This article is structured…


sense2vec is an incredible tool to get synonyms and correlations, given a keyword.
A keyword doesn’t have to be a standalone word, i.e. “medicine”, it could also be a compound word such as “machine learning”.

sense2vec can be used right away without training your own corpus.
In fact, it comes with two fully pretrained vector sets, namely reddit_2019 and reddit_2015. Here’s a link to the official documentation where you can download them.

This article is divided in:
1 — INSTALLATIONS
2 — IMPORTING LIBRARIES
3 — sense2vec
4 — FREQUENTLY ENCOUNTERED PROBLEMS

If you’re starting off, I would suggest going…


ft_printf is a project that mimics the real printf function.
Although wide in scope, it’s not a difficult project.

THINGS TO KEEP IN MIND before starting off:
Conversions to handle: csdiupxX%
Flags to handle: 0-.*
Value to return: length of the printed string (int).

Reading the man multiple times while coding will counter-intuitively save you a lot of time on special cases. I’ll just leave this one here as an example:

> man 3 printf
[..]
If the 0 and - flags both appear, the 0 flag is ignored. If a precision is given with a numeric conversion (d, i, o…


I thought I would never make it

My journey into coding has not been an easy one.
Mainly because I didn’t know how to start, and didn’t meet the right people right away.
This article is for those people who, like me, were not lucky enough to choose Computer Science as their college major, and who are trying to study it on their own.

In a maze

1 — Don’t think Computer Science is pure logic.
A major mistake I made when I started off studying on my own, is that I thought programming was so logical, that I had to be able to…


ft_server is a project by 42 school which introduces to docker containers and system administration.

This tutorial includes:
PART 1 — INSTALLATIONS
PART 2 — CONFIGURATIONS
PART 3 — PERMISSIONS
EXTRA — AUTOINDEX
for a complete project have a look here.

Docker is the famous 🐳 whale container.
A container is a all-packed-in-one system than can run on your machine while being entirely independent from it.
You can have python2 installed on your machine, and python3 installed in a container; you can have a machine that runs on ubuntu, and a container that runs on arch. …


Malloc, aka m-emory alloc-ation, allows you to provide memory for your variables when their size is unknown upfront.

Let’s imagine you are asking your user to insert their name in a video game you coded. There is no way to know upfront how long their name will be. In such cases, malloc comes and help us.

Int and char have by default a fixed size of memory, 4 bits for an int and 8 for a char. …


Docker has its own commands, just like git for example.
For example you would do `git status` to see what you’ve got in your tree, and you would do `docker ps -a` to see what you’ve got in docker.

Tame the whale 🐳!
A list of important commands to get you started is right below.

Image by Džoko Stach from Pixabay
# shows all containers, their ids, names,...
docker ps -a
# shows all images
docker images
docker container stop <id>
docker container rm <id> # remove
# remove all stopped containers
docker container prune
# remove all images of stopped containers
docker image prune
#…

Errors frequently encounters when compiling docker and how to fix them.
Tame the whale 🐳!

  1. Permission denied while trying to connect to the Docker daemon socket at unix
sudo groupadd docker
sudo usermod -aG docker ${USER}
su ${USER}
docker run hello-world #(to check if it's ok)

2. The container name ... is already in use by container "xxx". You have to remove (or rename) that container to be able to reuse that name.

docker rm -fv $(docker ps -aq)

3. Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use.

sudo lsof -i -P -n | grep <port_number>…

In May 2017, Youtube was broadcasting an epic game between the AI AlphaGo and the human player Ke Jie.

AlphaGo is an AI trained by playing solely against itself, i.e. against an AI, starting with zero data inputs and learning exclusively through self-play.

We can think of AlphaGo as made of 3 components:
. policy iteration
. Monte Carlo tree search (MCTS)
. policy evaluation

zihan

42born2code

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store