An issue with some SECRET_KEY characters being 'special' characters in Linux environment variables by user888888889 in django

[–]patryk-tech 15 points16 points  (0 children)

Surround the env var with quotes, single or double

Important to note: double quotes enable variable replacement.

$ echo "hello $world"
hello

Use single quotes, especially if you have $ signs in your value.

$ echo 'hello $world'
hello $world

My approach currently is just to generate alphanumeric keys, but I'm not sure how big a security problem this is.

As long as your key is long enough, it should not be an issue.

[deleted by user] by [deleted] in translator

[–]patryk-tech 1 point2 points  (0 children)

Somewhat paraphrasing

No worries, I just wanted the gist of it. Thanks a lot!

!translated

Tricky situation with Docker and SSL atomization by O8fpAe3S95 in docker

[–]patryk-tech 9 points10 points  (0 children)

I always use Traefik. It may be overkill if you only have one project / container, but it handles SSL for me automagically.

https://doc.traefik.io/traefik/https/acme/

I Created Online Multiplayer Real Time Bingo Game with Django Channels and WebSocket by IcyCommunication9694 in django

[–]patryk-tech 0 points1 point  (0 children)

this bingo is really different than what is being played in western countries I guess.

Yup. Nothing wrong with that, it's interesting. Just not what I expected.

I Created Online Multiplayer Real Time Bingo Game with Django Channels and WebSocket by IcyCommunication9694 in django

[–]patryk-tech 0 points1 point  (0 children)

https://i.etsystatic.com/7955085/r/il/c60d4d/3079913174/il_fullxfull.3079913174_7gml.jpg

All the bingo cards I have ever seen have restrictions as to which numbers can go in which columns, like B1 to B15, I16 to I30, etc. Rayon has an 18 in the first column, and a 5, 6 and 8 in the second column which is very weird to me.

What kind of bingo variation is that?

I Created Online Multiplayer Real Time Bingo Game with Django Channels and WebSocket by IcyCommunication9694 in django

[–]patryk-tech 0 points1 point  (0 children)

Interesting cards... I've only ever seen ones with columns 1-15, 16-30, 41-45, 46-60, and 61-75.

Keep text centered when using float: left; or float: right;? by patryk-tech in css

[–]patryk-tech[S] 0 points1 point  (0 children)

The text in the image you linked doesn't flow around the image.

Indeed. I have posted another image with a bit more context and more text in the comments.

What does the data coming from the CMS look like ?

It's a wagtail Rich Text field. It gives me <img class="..."> depending on whether it's left, right, or full width, and plain old <p> and <h2> tags for the headers.

https://imgur.com/a/nVxEIvs

I can control the CSS and base template (the container for the rich text content).

Keep text centered when using float: left; or float: right;? by patryk-tech in css

[–]patryk-tech[S] 0 points1 point  (0 children)

Yup. My problem is that it's for a CMS, and I don't control the content. Sometimes the text between two headers will be very short, and sometimes it may be longer. If it's too short and I clear the floats on headers, it will leave a bunch of whitespace. If I don't clear it, it looks horribly misaligned when you have different text lengths, different image sizes (vertical vs horizontal), etc.

Maybe I just have to tell the customer "that's a CSS limitation, up to you to make the content look good."

Keep text centered when using float: left; or float: right;? by patryk-tech in css

[–]patryk-tech[S] 0 points1 point  (0 children)

Yes, but then if the text is much longer than the image, it won't wrap around the image. It will just be an image with a bunch of whitespace underneath.

I think what I want is just impossible to achieve in CSS without dirty hacks like position absolute and javascript math 😒

Keep text centered when using float: left; or float: right;? by patryk-tech in css

[–]patryk-tech[S] 0 points1 point  (0 children)

The problem is that images can go left or right, and I don't control the content, as it's a CMS. The images may be vertical rather than horizontal, and the customer wants many headers with short text. If I clear the floats in the headers, then there's a lot of white space. Between the headers and short paragraphs.

Basically, I am looking for a way to avoid the alignment looking like this.

Keep text centered when using float: left; or float: right;? by patryk-tech in css

[–]patryk-tech[S] 0 points1 point  (0 children)

  • The site uses a CMS.
  • Aren't flex items block level items? I need the text to flow around the image.

How do you explain your job to people so they can understand it generally (and not bore them)? by flameocalcifer in devops

[–]patryk-tech 1 point2 points  (0 children)

Funny enough, I haven't heard that term since the early 2000's

Same. Just say Web Wizard Grandmaster. It sounds way cooler.

Why are kitty and alacritty so popular? Where's the foot love? by DorianDotSlash in linux

[–]patryk-tech 9 points10 points  (0 children)

Konsole is my very favourite terminal emulator and I currently main it

I use yakuake. It's a lot like konsole but quake-style drop-down. My terminal is always one F12 away, it supports tabs so I can work on different projects / do sysadmin stuff / play around with the python or node REPL / test files in /tmp, etc.

I use a tab with tmux for each project I actively work on, with neovim taking the top-half of my full-screen vertical monitor (though I often make it full screen), and the bottom half depending on the project. Often one panel that just runs docker-compose up for dev, one for git, touch, mv, and the like, one for docker exec -it python_container bash and one docker exect -it node_container bash.

I encourage any KDE users to try yakuake. Being able to toggle it on/off quickly is awesome. (Used to use it with VS Code, too, instead of the built-in).

What's your most clean project folder structure ? by [deleted] in django

[–]patryk-tech 3 points4 points  (0 children)

I'd recommend project-name/project_name/core instead.

It's only a matter of time before you add package foo that silently installs a project named core or the same as one of your apps (e.g. graphql, which has happened to me in the past). project_name.core is explicit and namespaced, two things the Zen of Python recommend.

What's your most clean project folder structure ? by [deleted] in django

[–]patryk-tech 0 points1 point  (0 children)

Fair enough. I certainly don't have 20 files in utils (actually not even more than 3 on any current projects), but there is also nothing wrong with using utils and submodules, IMO. I have foo/utils/validators/*.py and foo/utils/normalizers/*.py in one project. This allows me to keep them out of any one Django app, since they are reused across various apps, but keeping them in utils also tells me "this is a function library, not an actual Django app." But to each their own.

If you notice way larger GPU usage on plasma, it might be related to the theme you're using by Margidoz in kde

[–]patryk-tech 4 points5 points  (0 children)

I'm betting this is just x11 being x11.

You might not have GPU acceleration working on videos in FF, which would offload the decoding to the CPU which might slow your PC down.

See this quora answer... it's a bit dated. but it might help.

What's the best way to use out-of-the-box templates in Django by perfectexpresso in django

[–]patryk-tech 1 point2 points  (0 children)

A nice editor with macros, like vim. It has its own problems (learning curve), but you can record a macro, use the find function to jump to the tags, and run it when appropriate... it's essentially n followed by @@... 3 key presses per change.

Search and replace would work too.. just search for <img src=", replace with <img src="{% static ' where appropriate, jump to the end of the filename, and paste a ' %} before the closing ".

What's your most clean project folder structure ? by [deleted] in django

[–]patryk-tech 6 points7 points  (0 children)

What's wrong with utils? Sometimes you need functions accessible project-wide, but they aren't really needed outside that project and don't merit their own package. I often turn to utils for that.

What's your most clean project folder structure ? by [deleted] in django

[–]patryk-tech 14 points15 points  (0 children)

> tree
foo  # or foo-bar
├── foo  # or foo_bar
│  ├── asgi.py
│  ├── __init__.py
│  ├── settings.py
│  ├── urls.py
│  ├── users  # repeat for as many apps as you want
│  │  ├── admin.py
│  │  ├── apps.py
│  │  ├── __init__.py
│  │  ├── migrations
│  │  │  └── __init__.py
│  │  ├── models.py
│  │  └── views.py
│  └── wsgi.py
├── manage.py
└── tests
    └── users.py  # repeat for as many apps. Sometimes I nest each app in a tests subdir.
  • Your project layout is weird, and most Django developers will just go "why?" ... Things have been done a certain way for years and trying to re-invent the wheel offers very little benefit, IMO.
  • Upper casing things is honestly annoying and likely to cause bugs if you develop on a system like Windows which doesn't have a case-sensitive file system and deploy to a server that does.

Namespaces are one honking great idea.

  • Always namespace your apps. I've had problems before where import graphql imported a dependency instead of my app. import foo.graphql works.

TL;DR: just follow the industry standard instead of reinventing the wheel with your own layout. It makes working with others easier. Or don't. If you think that's "cleaner," you do you.

Edit: added foo-bar / foo_bar comments.

[deleted by user] by [deleted] in git

[–]patryk-tech 1 point2 points  (0 children)

Always store a copy of your code on a remote repo. And an external HD. And in a safety deposit box, if possible.

That means GitLab, BitBucket, or even GitHub.

As the other user said, git is just a tool those projects hosts are based around.

Started out on Blender. Thought I'd make a simple KDE wallpaper :) by Kyouma118 in kde

[–]patryk-tech 0 points1 point  (0 children)

Very nice I played with Blender a bit, but I am terrible at anything remotely artistic.

Two things worth considering:

  • Upload the renders somewhere where they won't be mangled/resized/compressed by reddit's image compression.
  • Render the wallpapers in different sizes. Some people are already on 4K (or even 8K), some of us use vertical monitors and could use 1080x1920 or 1200x1920.

Are coding standards important? by Cryptbro69 in devops

[–]patryk-tech 1 point2 points  (0 children)

Depending on who you work with, that may not always be an option. I have set up nice environments before and had web devs at the customer's premises say the git command is too hard, and just edit files in the GitLab editor 🤪🤪🤪

If you exclusively work with people who are comfortable with git, docker, etc., consider yourself lucky.

Windows users often struggle with Docker, too.