perjantai 8. toukokuuta 2020

Floating Point Visually Explained

submitted by /u/joesilver70 to r/programming
[link] [comments]

Introducing Inkscape 1.0

submitted by /u/dayanruben to r/programming
[link] [comments]

My KVM solution

I just wanted to share my GPU pass-through setup. I'm using NixOS and I followed this guide, line by line, to get my GPU working inside the VM. But I still wasn't happy. As I was tight on budget I bought a 15€ quadro from 1932 for the host and I passed my radeon 580 to the VM, since I want to game on it, but every time I needed to do some relatively graphics intensive work I had to hop on a Linux VM, so I could use the radeon.

Soo... I started looking for a way to run the VM and the host with the same graphics card. I was ready for the solution to be a bit hacky, but I legitimately couldn't find a workable solution for me. I was messing around with the the config.nix file (nixos's settings for most of the system) and the VM settings inside virt-manager and, at some point, I had the VM on auto-boot, and no DE enabled, and voilá, to my surprise, once I shut down the VM, after the auto boot, I am greeted by a TTY session, running on the same card as the vm was.

After more experimenting I realized that everything works fine, with only one card, as long as I stop the display manager before starting the VM (via virsh since virt-manager is a no go by then).

So I put together these scripts:

start_vm:

#!/bin/sh sudo systemctl stop display-manager.service && sleep 1 ; (sudo virsh start "$1" --console ; sudo systemctl start display-manager.service) 

start:

#!/bin/sh tmp=$(sudo virsh list --all | grep " $1 ") output=" - $1 shut off" if [ "$tmp" != "$output" ]; then echo "'$1' is not bootable. Either it doesn't exist or is not shut off." exit 1 fi; sudo daemonize /home/[my_user]/Desktop/start_vm "$1" 

They start a vm (./start Windows10, for example), stopping the display-manager just before actually starting it. And once the VM exits it starts the display-manager again. I added that little verification just so I don't stop and start the display manager every time I misspell a VM's name xd.

This said, is still one issue. The command systemctl stop is not synchronous, as such I need to sleep 1 before actually starting the vm, this usually works fine, but if there is any error while shutting down the display manager or, more importantly, I have too many windows open and the display manager takes longer to stop, the 1 sec sleepage won't bee enough. I could just be conservative and set it to 5 or smthn, but I can't be bothered to wait 5 secs every time xd.

I'd like to hear your guys' thoughts on this.

It was a fun ride and I hope this helps someone in the future!

PS: I know my shell scripts skills are terrible (this was actually my 2nd time using sh in a script). There is probably a better way to make that verification and there is also probably a way to not have 2 scripts, but I just couldn't figure out how xd.

EDIT!!!!!! : I completely overlooked the fact that I didn't, in the end, follow the guide line by line. I ended up not blacklisting the kernel modules respective to the drivers nor loading the vfio drivers on boot. I just let libvirt or qemu, I don't rly know, change the drivers on the fly. When I boot up the VM it loads the virtio drivers, when I shut it down it loads the amdgpu drivers again.

submitted by /u/Zizico2 to r/linux
[link] [comments]

torstai 7. toukokuuta 2020

How to start DOS game programming?

Hello guys, I am new to programming, I know the very basics of C, C++, Java, Python but nothing substantial to make a full fledged game. But I am willing to put a lot of work for this project. I just want to know what all utilities and languages were used to make DOS games. I've been searching a lot about DOS programming, but I couldn't find anything in detail or useful enough for me. It would be really cool if someone can also give documentation about the tools! Thanks!

submitted by /u/MRrock_the_c00L to r/dosgaming
[link] [comments]