Skip Navigation
Developing with Docker
  • I feel like you must have read an entirely different post, which must be a failing in my writing.

    I would never condone baking secrets into a compose file, which is why the values in compose.yaml aren't secrets. The idea is that your compose file is used exclusively for testing and development, where the data isn't real, and the priority is easing development. When you deploy, you don't use that compose file because your environment is populated by whatever you use in production (typically Kubernetes these days).

    You should not store your development database password in a .env file because it's not a secret. The AWS keys listed in the compose are meant to be exactly as they are there: XXX, because LocalStack doesn't care what these values are, only that they exist.

    As for the CLI thing, again I think you've missed the point. The idea is to start from a position of "I'm building images" and therefore neve have a "local app, (Django, sqlite)" because sqlite should not be used unless that's what's used in production. There should be little to no difference between development and production, so scripting a bridge between these doesn't make a lot of sense to me.

  • Developing with Docker
  • I don't mean to be snarky, but I feel like you didn't actually read the post 'cause pretty much everything you've suggested is the opposite of what I was trying to say.

    • A CLI to make things simple sounds nice, but given that the whole idea is to harmonise the develop/test/deploy process, writing a whole program to hide the differences is counterproductive.
    • Config settings should be hard-coded into your docker-compose file and absolutely not stored in .json or .env files. The litmus test here is: "How many steps does it take to get this project running?" If it's more than 1 (docker compose up) it's too many.
    • Suggesting that one package Django into a single Lambda seems like an odd take on a post about Docker.
  • Developing with Docker
  • High praise! Just keep in mind that my blog is a mixed bag of topics. A little code, lots of politics, and some random stuff to boot.

  • Developing with Docker
  • It's a tough one, but there are a few options.

    For AWS, my favourite one is LocalStack, a Docker image that you can stand up like any other service and then tell it to emulate common AWS services: S3, Lamda, etc. They claim to support 80 different services which is... nuts. They've got a strange licensing model though, which last time I used it meant that they support some of the more common services for free, but if you want more you gotta pay... and they aren't cheap. I don't know if anything like this exists for Azure.

    The next-best choice is to use a stand-in. Many cloud services are just managed+branded Free software projects. RDS is either PostgreSQL or MySQL, ElastiCache is just Redis, etc. For these, you can just stand up a copy of the actual service and since the APIs are identical, you should be fine. Where it gets tricky is when the cloud provider has messed with the API or added functionality that doesn't exist elsewhere. SQS for example is kind of like RabbitMQ but not.

    In those cases, it's a question of how your application interacts with this service. If it's by way of an external package (say Celery to SQS for example), then using RabbitMQ locally and SQS in production is probably fine because it's Celery that's managing the distinction and not you. They've done the work of testing compatibility, so theoretically you don't have to.

    If however your application is the kind of thing that interacts with this service on a low level, opening a direct connection and speaking its protocol yourself, that's probably not a good idea.

    That leaves the third option, which isn't great, but I've done it and it's not so bad: use the cloud service in development. Normally this is done by having separate services spun up per user or even with a role account. When your app writes to an S3 bucket locally, it's actually writing to a real bucket called companyname-username-projectbucket. With tools like Terraform, the fiddly process of setting all this up can be drastically simplified, so it's not so bad -- just make sure that the developers are aware of the fact that their actions can incur costs is all.

    If none of the above are suitable, then it's probably time to stub out the service and then rely more heavily on a QA or staging environment that's better reflective of production.

  • Developing with Docker
    danielquinn.org Developing with Docker

    You'd think that this topic would have been done to death, but given that *every* job I've started in the past 10+ years has used …

    Developing with Docker

    I've been writing code professionally for 24 years, 15 of which has been Python and 9 years of that with Docker. I got tired of running into the same complications every time I started a new job, so I wrote this. Maybe you'll find it useful, or it could even start a conversation, but this post has been a long time coming.

    Update: I had a few requests for a demo repo as a companion to this post, so I wrote one today. It includes a very small Django demo user Docker, Compose, and GitLab CI.

    15
    Got bored and created my attempt at Mirror Badgey in Inkscape
  • You got the eyes just right!

  • [article] Ford government to table legislation to restrict bike lanes on city streets | Globalnews.ca
  • Let me tell you how primary lane travel works in civilised countries: drunks and the others you mentioned end up in a canal, stranded up on a meridian, or crashed into a bollard.

    That's because they do more there than just say "share the lane" and call it a day. They narrow the road to almost exactly the width of a typical car using unforgiving barriers like bollards, medians, and 5m deep canals. They restructure the roads so they aren't straight throughways, but brick-paved, winding pathways through the city.

    They turn roads into obstacle courses, calming traffic, because as we all know, drivers may not be worried about killing cyclists, they're horrified by the idea of scratching their paint.

    They still have drunks of course, but they're typically on bikes (since driving is so impractical), and they too often end up in a canal.

    Here's a decent example from Amsterdam where they effectively have 3 classes of road:

    • Highways where no bikes are permitted but there are always entirely separate cycle path options to travel the same distance.
    • Wide through roads with level asphalt paving and typically a curb, a row of trees, a tram, or other safe barrier between cars and cyclists.
    • Narrow, often winding shared roads where traffic is naturally calmed by the terrain: bollards, canals, bricks or cobblestone, big speed bumps, raised crosswalks, or other oncoming cars in a space clearly designed for a maximum of one. Even the traffic lights here are configured to reduce speed by defaulting to red in all directions.

    That last category is the majority over there, and a big reason why the city is so safe and quiet... unless it's King's Day or New Years eve. Then these spaces are flooded with loud, drunk pedestrians or children shooting fireworks at random. On those days I recommend trips out of town ;-)

  • [article] Ford government to table legislation to restrict bike lanes on city streets | Globalnews.ca
  • This could actually be good news. At the end of the day, bike lanes are car infrastructure. If you want a cycling city, what you need are narrow, slow, winding roads that're car-hostile. If you can't have bike lanes, then this could be the opportunity to restructure the roads so that cycling in the primary lane is the default option for everyone.

  • Unions Must Rise Again to Face the Challenges of AI and Automation
  • This is one of the most infuriating things about the left. Automation is fantastic! Why the hell should we rail against something that reduces the amount of work people have to do? Why oppose something that reduces risks we have to take in our daily lives?

    There's no dignity in human labour. We do it because our survival depends on it. The problem is that the automation of that labour is treated by capitalists as a net profit to the owning class.

    We should not be fighting to "maintain employment" FFS. We should be fighting for a reasonable share of the fruits of our community. If your job is automated, you should get a share of the company profits for life and then happily leave for new and different work, not try to prevent the automation in the first place.

  • Small linux-friendly laptop
  • Yeah that was the big strike against it for me too. I found that you can sort of perch it over a crossed leg and it's sort of serviceable that way, but yeah... no coding on the train with a Surface.

  • Small linux-friendly laptop
  • The Surface Pro keyboard is actually quite good, with the added bonus that it's also easily detachable.

  • My UX seemed to really slow down after the update
  • Hmm. Annoying. I'm on an FP4 as well, but this is the first time I've seen this.

  • My UX seemed to really slow down after the update
  • Yeah I made the same mistake. I bumped it to 5x and ho boy did everything slow down.

  • Fairphone releases a Fairphone 5 with 6gb RAM and 128gb storage for €150 less
  • I have an FP4 and I love it. I only ever have problems with the fingerprint sensor when my hands are dirty or overly sweaty. The camera works rather well to be honest, but I did replace the app with the Googled one.

    I can't speak to Android Auto, 'cause I've never used it, and don't know what ARKit is. I do heavily use Google (and Organic) Maps though, and I find the accuracy of both the GPS and compass to be quite good.

    Honestly, I generally find the hardware to be pretty solid and have been using it since the FP4 was released without issue. I connect it to my computer to transfer Very Large Files all the time, and regularly push a lot of data through the wifi.

    I've been abusing the shit out of the battery though, so I just ordered a replacement one. Something most phones still can't do. It's Fairphone's killer feature in my book.

    I'm not posting this to invalidate your experience, just to demonstrate that there are others who feel differently.

  • My UX seemed to really slow down after the update
    mastodon.social Daniel Quinn (@danielquinn@mastodon.social)

    Attached: 1 image After an update, my #Fairphone appeared to slow down, but it wasn't overloaded. Apps all performed their jobs quickly, but the *animations* were sluggish. Digging into the "Developer Options", I noted that the drawing animations were all set to `2x`, and bumping them down to `1`...

    Daniel Quinn (@danielquinn@mastodon.social)

    ...so I found out how to fix it

    5
    Is Linux As Good As We Think It Is?
  • This too is an excellent take. "Artificial pain points" for capitalism, or "learn some shit" for Linux. Love it.

  • Port Forwarding/Redirecting
  • At the firewall level, port forwarding forwards traffic bound for one port to another machine on your network on an arbitrary port, but the UI built on top of it in your router may not include this.

    If it's not an option in your Fritzbox, your options are:

    • Make the service running on your internal network listen on one of those high-number ports instead.
    • Introduce another machine on the network that also performs NAT between your router and your machine
    • Try to access the underlying firewall in your router to tweak the rules manually. Some routers have an admin console accessible via telnet or SSH that may allow this.
    • Get a new router.

    The first and last options on this list are probably the best.

  • Is Linux As Good As We Think It Is?
  • You make an excellent point. I have a lot more patience for something I can understand, control, and most importantly, modify to my needs. Compared to an iThing (when it's interacting with other iThings anyway) Linux is typically embarrassingly user hostile.

    Of course, if you want your iThing to do something Apple hasn't decided you should want to do, it's a Total Fucking Nightmare to get working, so you use the OS that supports your priorities.

    Still, I really appreciate the Free software that goes out of its way to make things easy, and it's something I prioritise in my own Free software offerings.

  • Europe jumps on the train
  • What site are you using to book night trains?

  • BC is the 3rd panel right now - bolt cutters in hand
  • The Liberals are happy to lose elections if it means that they'll get their turn again in a few years when FPTP guarantees another run for them.

  • The number of lines for each character by percentage of the series

    It would seem that I have far too much time on my hands. After the post about a Star Trek "test", I started wondering if there could be any data to back it up and... well here we go:

    Those Old Scientists

    | Name | Total Lines | Percentage of Lines | | ---------------- | :---------: | ------------------: | | KIRK | 8257 | 32.89 | | SPOCK | 3985 | 15.87 | | MCCOY | 2334 | 9.3 | | SCOTT | 912 | 3.63 | | SULU | 634 | 2.53 | | UHURA | 575 | 2.29 | | CHEKOV | 417 | 1.66 |

    The Next Generation

    | Name | Total Lines | Percentage of Lines | | ---------------- | :---------: | ------------------: | | PICARD | 11175 | 20.16 | | RIKER | 6453 | 11.64 | | DATA | 5599 | 10.1 | | LAFORGE | 3843 | 6.93 | | WORF | 3402 | 6.14 | | TROI | 2992 | 5.4 | | CRUSHER | 2833 | 5.11 | | WESLEY | 1285 | 2.32 |

    Deep Space Nine

    | Name | Total Lines | Percentage of Lines | | ---------------- | :---------: | ------------------: | | SISKO | 8073 | 13.0 | | KIRA | 5112 | 8.23 | | BASHIR | 4836 | 7.79 | | O'BRIEN | 4540 | 7.31 | | ODO | 4509 | 7.26 | | QUARK | 4331 | 6.98 | | DAX | 3559 | 5.73 | | WORF | 1976 | 3.18 | | JAKE | 1434 | 2.31 | | GARAK | 1420 | 2.29 | | NOG | 1247 | 2.01 | | ROM | 1172 | 1.89 | | DUKAT | 1091 | 1.76 | | EZRI | 953 | 1.53 |

    Voyager

    | Name | Total Lines | Percentage of Lines | | ---------------- | :---------: | ------------------: | | JANEWAY | 10238 | 17.7 | | CHAKOTAY | 5066 | 8.76 | | EMH | 4823 | 8.34 | | PARIS | 4416 | 7.63 | | TUVOK | 3993 | 6.9 | | KIM | 3801 | 6.57 | | TORRES | 3733 | 6.45 | | SEVEN | 3527 | 6.1 | | NEELIX | 2887 | 4.99 | | KES | 1189 | 2.06 |

    Enterprise

    | Name | Total Lines | Percentage of Lines | | ---------------- | :---------: | ------------------: | | ARCHER | 6959 | 24.52 | | T'POL | 3715 | 13.09 | | TUCKER | 3610 | 12.72 | | REED | 2083 | 7.34 | | PHLOX | 1621 | 5.71 | | HOSHI | 1313 | 4.63 | | TRAVIS | 1087 | 3.83 | | SHRAN | 358 | 1.26 |

    Discovery

    Important Note: As the source material is incomplete for Discovery, the following table only includes line counts from seasons 1 and 4 along with a single episode of season 2.

    | Name | Total Lines | Percentage of Lines | | ---------------- | :---------: | ------------------: | | BURNHAM | 2162 | 22.92 | | SARU | 773 | 8.2 | | BOOK | 586 | 6.21 | | STAMETS | 513 | 5.44 | | TILLY | 488 | 5.17 | | LORCA | 471 | 4.99 | | TARKA | 313 | 3.32 | | TYLER | 300 | 3.18 | | GEORGIOU | 279 | 2.96 | | CULBER | 267 | 2.83 | | RILLAK | 205 | 2.17 | | DETMER | 186 | 1.97 | | OWOSEKUN | 169 | 1.79 | | ADIRA | 154 | 1.63 | | COMPUTER | 152 | 1.61 | | ZORA | 151 | 1.6 | | VANCE | 101 | 1.07 | | CORNWELL | 101 | 1.07 | | SAREK | 100 | 1.06 | | T'RINA | 96 | 1.02 |

    If anyone is interested, here's the (rather hurried, don't judge me) Python used:

    ```python #!/usr/bin/env python

    This script assumes that you've already downloaded all the episode lines from

    the fantastic chakoteya.net:

    wget --accept=html,htm --relative --wait=2 --include-directories=/STDisco17/ http://www.chakoteya.net/STDisco17/episodes.html -m

    wget --accept=html,htm --relative --wait=2 --include-directories=/Enterprise/ http://www.chakoteya.net/Enterprise/episodes.htm -m

    wget --accept=html,htm --relative --wait=2 --include-directories=/Voyager/ http://www.chakoteya.net/Voyager/episode_listing.htm -m

    wget --accept=html,htm --relative --wait=2 --include-directories=/DS9/ http://www.chakoteya.net/DS9/episodes.htm -m

    wget --accept=html,htm --relative --wait=2 --include-directories=/NextGen/ http://www.chakoteya.net/NextGen/episodes.htm -m

    wget --accept=html,htm --relative --wait=2 --include-directories=/StarTrek/ http://www.chakoteya.net/StarTrek/episodes.htm -m

    Then you'll probably have to convert the following files to UTF-8 as they

    differ from the rest:

    * Voyager/709.htm

    * Voyager/515.htm

    * Voyager/416.htm

    * Enterprise/41.htm

    import re from collections import defaultdict from pathlib import Path

    EPISODE_REGEX = re.compile(r"^\d+\.html?$") LINE_REGEX = re.compile(r"^(?P<name>[A-Z']+): ")

    EPISODES = Path("www.chakoteya.net") DISCO = EPISODES / "STDisco17" ENT = EPISODES / "Enterprise" TNG = EPISODES / "NextGen" TOS = EPISODES / "StarTrek" DS9 = EPISODES / "DS9" VOY = EPISODES / "Voyager"

    NAMES = { TOS.name: "Those Old Scientists", TNG.name: "The Next Generation", DS9.name: "Deep Space Nine", VOY.name: "Voyager", ENT.name: "Enterprise", DISCO.name: "Discovery", }

    class CharacterLines: def init(self, path: Path) -> None: self.path = path self.line_count = defaultdict(int)

    def collect(self) -> None: for episode in self.path.glob(".htm"): if EPISODE_REGEX.match(episode.name): for line in episode.read_text().split("\n"): if m := LINE_REGEX.match(line): self.line_count[m.group("name")] += 1

    @property def as_tablular_data(self) -> tuple[tuple[str, int, float], ...]: total = sum(self.line_count.values()) r = [] for k, v in self.line_count.items(): percentage = round(v * 100 / total, 2) if percentage > 1: r.append((str(k), v, percentage)) return tuple(reversed(sorted(r, key=lambda _: _[2])))

    def render(self) -> None: print(f"\n\n# {NAMES[self.path.name]}\n") print("| Name | Total Lines | Percentage of Lines |") print("| ---------------- | :---------: | ------------------: |") for character, total, pct in self.as_tablular_data: print(f"| {character:16} | {total:11} | {pct:19} |")

    if name == "main": for series in (TOS, TNG, DS9, VOY, ENT, DISCO): counter = CharacterLines(series) counter.collect() counter.render() ```

    13
    I made a thing: "django-cool-urls"
    danielquinn.org django-cool-urls

    It's taken the better part of six months, working a few hours in the evenings when I can scratch the time together, but my latest …

    django-cool-urls
    6
    What're some of the dumbest things you've done to yourself in Linux?

    I'm working on a some materials for a class wherein I'll be teaching some young, wide-eyed Windows nerds about Linux and we're including a section we're calling "foot guns". Basically it's ways you might shoot yourself in the foot while meddling with your newfound Linux powers.

    I've got the usual forgetting the . in lines like this:

    $ rm -rf ./bin

    As well as a bunch of other fun stories like that one time I mounted my Linux home folder into my Windows machine, forgot I did that, then deleted a parent folder.

    You know, the war stories.

    Tell me yours. I wanna share your mistakes so that they can learn from them.

    Fun (?) side note: somehow, my entire ${HOME}/projects folder has been deleted like... just now, and I have no idea how it happened. I may have a terrible new story to add if I figure it out.

    303
    I'm having serious problems with Omega

    I've got a very simple Kodi setup:

    • Arch Linux on a laptop behind the TV
    • Media files on a server upstairs, shared over NFS

    I've been running Kodi quite successfully on this machine for years, but with the Omega update, videos play without audio for about 10seconds, then freeze. Sometimes if I wait a while, I see subtitles for the episode while the video is frozen. Music doesn't play either. The interface freezes too, to the point where I have to kill -9 it. Switching from Wayland to Xorg hasn't had an effect.

    I tried deleting ~/.kodi and restarting, but nothing changes.

    Has anyone else run into this?

    3
    Some dude 3D printed a little house for his local frog
    mastodon.social Maaike (@MaaikeV@mastodon.social)

    Attached: 1 video Makers rule! Meet Frodrick and the evolution of his house Trust me, it’s worth it, it’ll make you smile #maker #frodrick #3DPrinting

    Maaike (@MaaikeV@mastodon.social)

    A break from the usual in this community, but I trust it'll be appreciated. I think this is very solarpunk: using technology to improve the lives of all creatures.

    5
    I lost days of play time to a stream cloud sync error

    I've been playing a lot of Fallout 4 over the holidays. I started and finished the Nuka World DLC (killed all the baddies), made it to level 90, etc.

    Today I was playing on my Deck as the battery got a little low (11%) so I saved my game, exited the game, and went to shut down.

    As it was shutting down, the Deck displayed a message, something like "Syncing to Steam Cloud" as the logo was spinning.

    A few hours later, on a full charge, I booted it back up, started Fallout 4 again and... some of my old saves are there, but only about 30% of them, and critically not the most recent ones.

    Has this ever happened to anyone else? Is this a known issue? Can I fix it, or report it? I've basically lost interest in finishing the game now.

    8
    9 days after writing in defence of a Free Palestine, Paul Biggar is dropped from his director role at CircleCI
    hachyderm.io Paul Biggar (@paulbiggar@hachyderm.io)

    Attached: 1 image Actions have consequences, and that's ok

    Paul Biggar (@paulbiggar@hachyderm.io)

    His original post , titled I can't sleep, is some brilliant writing. When we talk about the chilling effect that criticism of Israel creates in industries everywhere (including ours) this is what that looks like.

    96
    A giant, muscular penguin roaring in a comic book style

    I needed something for a presentation I'm doing on advanced Linux, so I thought something like this might be appropriate.

    Annoyingly, I can't seem to get Bing to generate an image that isn't square.

    8
    Ash Vs Bash

    [For reference, I'm talking about Ash in Alpine Linux here, which is part of BusyBox.]

    I thought I knew the big differences, but it turns out I've had false assumptions for years. Ash does support [[ double square brackets ]] and (as best I can tell) all of Bash's logical trickery inside them. It also supports ${VARIABLE_SUBSTRINGS:5:12}` which was another surprise.

    At this stage, the only things I've found that Bash can do that Ash can't are:

    • Arrays, which Bash doesn't seem to do well anyway
    • Brace expansion, which is awesome but I can live without it.

    What else is there? Did Ash used to be more limited? The double square bracket thing really surprised me.

    10
    I made a thing to make playing YouTube videos locally from your browser easier
    gitlab.com Daniel Quinn / video-bypass · GitLab

    Watch YouTube videos locally by clicking a button

    Daniel Quinn / video-bypass · GitLab

    The other day someone was complaining about the new ad blocker-blocker on YouTube and I mentioned that it might be fun to write a Firefox extension that would just load up yt-dlp and play the video through mpv.

    It turns out, writing a Firefox extension is easy and tricking Firefox into launching yt-dlp isn't much harder (though it does require some annoying configuration on the user's end).

    Anyway, if you're a Linux user, feel free to try it out. I don't know how much I'm going to pour into this, but as an exercise of "can this be done", it was pretty good for a few hours on a Friday night.

    19
    Where can I eat the Midsummer Common cows?

    They must get turned into streaks to be eaten somewhere right? It'd be nice if every morning that I have to ride my bike through their wet piles of shit, I can think to myself: "at least I'll get to eat you at ________ in a few months".

    0
    Request a Feddit.uk community @feddit.uk Daniel Quinn @lemmy.ca
    Cambridge

    There was a reasonably active community on Reddit, but now that I'm not there anymore, I miss it.

    1
    I like the *idea* of solarpunk...

    ...but I think I'd probably be miserable there.

    I'm violently allergic to pollen, am terrified of bees, wasps, and grasshoppers, and generally despise bugs and dirt. My ideal world would see everything paved in marble. No cars, (obviously) with a quiet, sustainable, walkable communiy, but green, as beautiful as it is, causes me a great deal of pain.

    It's there any place for me in a solarpunk world?

    2
    danielquinn Daniel Quinn @lemmy.ca

    Canadian software engineer living in Europe.

    Posts 16
    Comments 460