What Does this Code Snippet Do?

The first part (add_filter()) tells WordPress to use the direct-write method. The second part (define()) tells WordPress to apply 0751 permissions to any directory it creates. More information here.

I would not consider using the Direct Write method to be safe to use in a live, public, shared-hosting environment.

Also, it might not – and in fact probably won’t – work in a shared-hosting environment.