daco

joined 1 year ago
 

cross-posted from: https://lemm.ee/post/48031022

Hi,

I wanted to use d2 in an environment where I could only install python and npm packages.

Given that, and that I could not find any other solution, I made d2-python-wrapper, a small python wrapper that bundles the d2 binaries.

Now you can use d2 from python like this:

from d2_python import D2

d2 = D2()

# Simple diagram
with open("test.d2", "w") as f:
    f.write("x -> y")

# Default SVG output
d2.render("test.d2", "output.svg")

# PDF output with specific theme
d2.render("test.d2", "output.pdf", format="pdf", theme="1")

The class just wraps the bin, so it works and supports the same as the bin. There is a GitHub Action that gets the bins for each platform (mac, win, linux) from the releases in this repo and publishes it to pip.

You can install this using

pip install d2-python-wrapper

Here is a short post with more context.

Just in case It's useful for anyone. 😁

 

Hi,

I wanted to use d2 in an environment where I could only install python and npm packages.

Given that, and that I could not find any other solution, I made d2-python-wrapper, a small python wrapper that bundles the d2 binaries.

Now you can use d2 from python like this:

from d2_python import D2

d2 = D2()

# Simple diagram
with open("test.d2", "w") as f:
    f.write("x -> y")

# Default SVG output
d2.render("test.d2", "output.svg")

# PDF output with specific theme
d2.render("test.d2", "output.pdf", format="pdf", theme="1")

The class just wraps the bin, so it works and supports the same as the bin. There is a GitHub Action that gets the bins for each platform (mac, win, linux) from the releases in this repo and publishes it to pip.

You can install this using

pip install d2-python-wrapper

Here is a short post with more context.

Just in case It's useful for anyone. 😁

[–] daco@lemm.ee 1 points 3 months ago (1 children)

Ok. Thank you for the explanation!

I'm just now thinking out los here, but would it make sense to use a PowerShell script to silently install miniconda and create a venv with a specific version?

Something like

@echo off
REM Download Miniconda installer (replace URL with the latest version)
powershell -Command "Invoke-WebRequest https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -OutFile miniconda.exe"

REM Install Miniconda silently
start /wait "" miniconda.exe /InstallationType=JustMe /RegisterPython=0 /S /D=%UserProfile%\Miniconda3

REM Create a new environment with the specific Python version
call %UserProfile%\Miniconda3\Scripts\activate.bat
call conda create -y -n py39 python=3.9

REM Optional: Set permissions for multi-user access
icacls %UserProfile%\Miniconda3 /grant:r Users:(OI)(CI)F /T

More on that here https://docs.anaconda.com/anaconda/install/silent-mode/

Again, this is just an idea, but if this works then you won't have a problem anymore (maybe?).

[–] daco@lemm.ee 1 points 3 months ago (3 children)

I get your points!

But just out of curiosity, did you try using miniconda to install older python versions? That works wonders for me, also on windows 11.

[–] daco@lemm.ee 2 points 11 months ago

Wow. That’s a great idea! Death is Sleep and Exile is You are grounded!

I will elaborate on this when I get to this situations and update the article accordingly.

[–] daco@lemm.ee 4 points 11 months ago (1 children)

Hi. Thank you for your feedback!

In the case of 3-years-old I would also recommend removing the creatures with strong graphics. In my case, with my 6-years-old, I remove all the black cards, as they mostly have graphics with death, corruption and destruction.

I didn’t thought of playing memory with MTG. It’s actually interesting 🤔

[–] daco@lemm.ee 5 points 11 months ago

Hi! I’m aware of Magic Jr. https://magic-jr.com

I checked that but I had the feeling it was to different from the normal game.

In the reddit post someone posted a link to this video,https://www.reddit.com/r/magicTCG/s/ZSzT7xjIWi and its some tu Ing similar or the same (it is also called Magic Junior).

I wanted to keep using the cards I already have instead of creating new one (or printing them from the Magic Jr. website), as I think it will be easier to transition to the full game. Instead of learning new card my daughter will just have to read and understand new parts of the same cards.

I think they are two different approaches with the same goal. I will update the article as soon as I have time to mention this alternative. That way the reader can choose between both alternatives.

Thanks for your feedback! Best,

Diego

 

Adapt/ simplify MTG rules for Kids

Hi! I wrote an article on my blog about adapting MTG rules for kids and I thought it would be interesting for some parents with small kids who have yet to learn how to read.

To get in context, I have a 6-years-old daughter who wanted to play with me. I tried to teach her some rules but, given that she can’t read yet, was a little hard to explain everything. Then I also realized that she didn’t like some concepts (like graveyard), so I adapted the rules in a way that, I hope, will be easier for her to understand the real rules when she grows up (and that it will be easier for me to explain).

The result is that we have played many times since and we have had fun :)

If you have improvements to the article, such as other rules, I would be happy to read them.

Cheers, and happy game :)

FYI: I also posted this on Reddit

[–] daco@lemm.ee 1 points 1 year ago

GoatCounter works great, has a free hosted plan and is open source (and you can self-host it). You can export all your data, manage privacy settings, manage users and so on. Made in Go.

[–] daco@lemm.ee 1 points 1 year ago

My experience with openSuse Tumbleweed has been mostly great so far.

I’ve used linux the last 20+ years (Debian, Ubuntu, manjaro, elementary os, fedora and so on).

For me the best ones so far have been Debian and Ubuntu server edition (for servers), Linux mint and openSuse (for desktop use).

I tried openSuse because I didn’t want to upgrade my system every 6 months (for Ubuntu) nor every many years (for Debian). I like the idea of having a stable main desktop system which I can rely on and it just works. I’m hoping openSuse Tumbleweed is that system.

I’ve used primarily openSuse with KDE on my main machine the last year and I’ve had the folllowing issues:

  • some VPN connections do not work but the same one does work without problems on Linux mint. (For example the Fritz-box VPN) I’m still researching this.
  • most tutorials are made for Ubuntu and other distros, so you have to search a bit more to find answers. (I’ve written a few on my site) You need more time and knowledge to do some stuff on openSuse, because the defaults are more secure (or less permissive). For example sharing a folder on a network or adding a network printer means configuring the firewall rules, which on Linux mint, Ubuntu and many others is not required (which also means that the required ports are open and the required packages are pre installed).

What I’ve liked

  • there defaults are more secure and that means I’ve learned what some apps need and I’ve understand a little bit how they work.
  • zypper dup is great and I love having a rolling distribution. (I also love apt-get btw)
  • I feel openSuse is more stable (as a desktop, I haven’t tried it on servers yet) although I don’t have any basis to say that. I have another machine with linux mint and I feel I have more problems with stability there. (Again, this is just a feeling)
[–] daco@lemm.ee 4 points 1 year ago

I’m using this with Nextcloud through WebDAV.

There is a keepass app in Nextcloud to access your keepass database using a web browser (keeweb), keepassXC has a client for Linux, Mac and windows (and all of them work great) and there are many apps for iOS and android.

I use the free version of Strongbox with WebDAV and I haven’t had any problems.

You can just backup the keepass database file and you can also have several databases. Each database has its own password.

[–] daco@lemm.ee 2 points 1 year ago (1 children)

I’ve been testing https://photoview.github.io running locally on docker and it’s working just fine. Face recognition works amazingly well and fast.

Nextcloud also has a photo album app with face recognition (additional app) which I’ve been meaning to try. There is also the new https://memories.gallery/ also in my list of apps to test :)

At https://github.com/photoview/photoview are also the following names as alternatives:

I hope that helps :)