trymeout

joined 2 years ago
[–] trymeout@lemmy.world 2 points 1 month ago

Agreed.

I also use this VSCode extension which formats my bash code using shfmt

https://open-vsx.org/extension/foxundermoon/shell-format

[–] trymeout@lemmy.world 1 points 1 month ago (1 children)

You should not need an else if statement to re-enable the internal display. When no displays are enabled, it will enable the internal display. This was the case when I tested it.

[–] trymeout@lemmy.world 3 points 1 month ago (1 children)

What company do you work for in XR?

I got the XReal One as a portable ergonomic monitor and I may use them as my main monitor going forward. I have a sit/stand desk with monitor arms which I can adjust the height and position for an ergonomic design to always look straight at the monitor and not looking down.

From my research currently the XReal Ones are the best AR/XR glasses on the market due to the chip built into them, not needing any other devices or software to run, just plug in play. The XReal One Pros which I think are coming out soon have some better specs but to me, not worth the extra money.

I been using them for regular desktop/laptop task and coding and I prefer to use the anchor mode when doing this. I sometimes also use the ultra-wide mode to simulate 2 monitors. I also been using them for gaming and I will either have it in follow or anchor mode but never use ultra-wide mode for gaming.

 

I created a simple Bash script that will always disable the default/internal monitor on your laptop when using AR glasses (or any other external monitor). I find this useful for when using AR glasses such as the XReal One which allows you to change the mode from regular mode to ultra-wide mode and when doing this, it will act as your unplugging the XReal ones and plugging in XReal one again in a new mode, causing the interal laptop display to become enabled.

To keep the laptop display always off, weather the laptop lid is either closed or open, this simple bash script will always disable the laptop screen every X seconds (You can change it by changing the wait variable)

Simply copy this script and create a new bash script such as disable-display.sh, make the script file executable and add it to your startup applications and it will run in the background. You will need to run xrandr command with all of your displays enabled to get the names of the displays and change the variable names in the script accordingly.

NOTE: This script may not work with a full Wayland setup and may only work on X11.

Enjoy

#!/bin/bash

#RUN xrandr TO GET THE NAMES OF THE DISPLAYS AND SET THE VARIABLES TO THESE NAMES

readonly default_display="eDP"
readonly external_display="USB-C-0"

readonly wait=5

while true; do
    #Check if there is an external display connected
    if xrandr | grep -q "$external_display connected"; then
        #Disable the internal display
        xrandr --output $default_display --off
    fi

    sleep $wait
done
[–] trymeout@lemmy.world 0 points 8 months ago

Thank for sharing rust-script which is basically what I made but written in Rust and seems to store the binary in another directory when the binary is exexuted.

Is the RFC trying to introduce a command cargo script to run single rust scripts?

[–] trymeout@lemmy.world 0 points 8 months ago (2 children)

It could be done with a one liner in the terminal but adding arguments when running the binary will be in the middle of the command, not at the end of the command.

Also the usecase for me is for sample scripts I have. This makes it easy to compile, run and delete the binary.

 

I would like to share a bash script I made for when you want to simply run a rust script once and delete it. Instead of having compile the script with rustc, running the binary and then deleting the binary, you can achive all of this with this bash script below.

The first argument will be the rust script file name. The .rs file extension is optional. The rest of the arguments are passed into the executed binary.

Simply name the bash script to something like rust-run.sh.

#!/bin/bash

#Get file path from first parameter
path=$(dirname "$1")

#Get file name from first parameter
fileName=$(basename "$1")
fileName="${fileName%'.rs'}"

#Compile executable and save it in the same directory as the rust script
rustc "${path}/${fileName}.rs" -o "${path}/${fileName}"

#If rustc commands retuned any errors, unable to compile the rust script
if [ $? -ne 0 ]; then
    return
fi

#Execute compilled executable and pass the rest of the parameters into the executable
"${path}/${fileName}" ${*:2}

#Delete compillled executable
rm "${path}/${fileName}"

If someone wants to rewrite this in rust or add these features into the rustc, feel free to do so.

 

Just started learning Rust today and got Rust installed, got the hello world example compiled and running. I installed rust-analyzer and CodeLLDB extensions in VSCode. Enable the debug.allowBreakpointsEverywhere settings to VSCode to be true. Setup a debug configuration in VSCode.

However I keep getting errors from rust-analyzer when I run the debugger...

2024-10-06T22:16:04.808655Z ERROR FetchWorkspaceError: rust-analyzer failed to load workspace: Failed to load the project at /home/john/Documents/Snippets/Rust/Cargo.toml: Failed to read Cargo metadata from Cargo.toml file /home/john/Documents/Snippets/Rust/Cargo.toml, Some(Version { major: 1, minor: 81, patch: 0 }): Failed to run `cd "/home/john/Documents/Snippets/Rust" && RUSTUP_TOOLCHAIN="/home/john/.rustup/toolchains/stable-x86_64-unknown-linux-gnu" "/home/john/.cargo/bin/cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/john/Documents/Snippets/Rust/Cargo.toml" "--filter-platform" "x86_64-unknown-linux-gnu"`: `cargo metadata` exited with an error: error: failed to parse manifest at `/home/john/Documents/Snippets/Rust/Cargo.toml`

Caused by:
  no targets specified in the manifest
  either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present

I not sure how to fix this.

I would like to get the VSCode debugger to work for launch debugging, attach debugging and launch and attach debugging for rust running inside a docker container. This will be a good setup for getting started I believe.

This is my VSCode debugger configuration...

{
	// Use IntelliSense to learn about possible attributes.
	// Hover to view descriptions of existing attributes.
	// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
	"version": "0.2.0",
	"configurations": [
		{
			"type": "lldb",
			"request": "launch",
			"name": "Debug",
			"program": "${workspaceFolder}/hello-world",
			"args": [],
			"cwd": "${workspaceFolder}"
		}
	]
}

Any help and advice will be most appreciated.

[–] trymeout@lemmy.world 1 points 10 months ago

Would like to see an Android version as well that has its own F-Droid repo

[–] trymeout@lemmy.world 1 points 11 months ago (1 children)

I’ll look up my notes tomorrow and post more details.

Thank you. Been struggling to get my IDE setup for go development.

[–] trymeout@lemmy.world 1 points 11 months ago (3 children)

This solution does with when using a launch request in the config. Thank you

Do you have a simple guide by chance on how to get debugging to work inside a docker container using VSCode?

 

I made some Go scripts that require user input fmt.Scanln(&fileName) during the execution. When I use the Go debugger built into VSCode which is the launch type, it works but there is no way to enter any prompts when your exeuctable asks for a input. With other programming languages like NodeJS and PHP, there is way to run the scripts in "debugging mode" where it will run the code but before it executes the code, it will wait to attach to a debugger on your system and then execute the code. This has always allowed me to use the terminal for inputs in the executable.

For example to do this in NodeJS, you will use node --inspect-brk=0.0.0.0 main.js instead of node main.js and then run the debugger in VSCode to attach it to the executing script. Is there a way to do this with Go? Do I need to set something up to achieve this?

I am on Linux Mint and cannot find any commands to run go run . but to wait for a debugger to attach to the executable before executing.

[–] trymeout@lemmy.world 1 points 1 year ago

When I change the path to this...

docker container create --name nginx -v $(pwd)/nginx.conf:/etc/nginx/conf.d/nginx.conf -v $(pwd):/app/ -p 80:80 docker.io/nginx

It does not seem to make a difference since when I go to localhost in my browser, I am still greeted with the "Welcome to nginx!" page.

 

Is it possible to create a volume that is a file, not a directory?

I am trying to make a simple structured nginx instance with docker. Using this command below to create the container...

docker container create -v ./nginx.conf:/etc/nginx/conf.d/nginx.conf -v .:/app/ -p 80:80 docker.io/nginx

And this is the file structure of it...

- www
-------------- public
---------------------------- index.html
- nginx.conf

And this is the nginx.conf

server {
    server_name localhost;
    listen 80;
    
    root /app/www/public;

    index index.html index.htm;
    autoindex on;
}

However the index.html will not work when I go to the localhost.

When I change the docker command to this it does work however, but this will also mirror all of the files and folder from my file structure into the containers /etc/nginx/conf.d/ directory

docker container create -v .:/etc/nginx/conf.d/ -v .:/app/ -p 80:80 docker.io/nginx
[–] trymeout@lemmy.world 1 points 2 years ago (1 children)

This one looks promising especially if the dev adds this feature I requested. It is written in Dart.

https://github.com/emavgl/oinkoin/issues/9

 

Not complianing about it since it gives us a good selection, but it is a trend I have been noticing lately.

 

I had an idea/feature request for Linux itself.

With many debian based distros (Arch has this too but it is a different GUI) you can encrypt your entire computer which will require you to enter a password to decrypt it when booting it up.

On every linux distro I used weather it is debian or arch based, you can setup a specific user to be the user the computer automatically logins to when the system boots up.

The annoying thing about using the auto login feature for a user is that it does not unlock the keyring. If you have apps setup to run in the background on startup, they may require you to unlock your keyring. Sure, you can set the keyring password to be blank but this is not a good idea for security reasons.


This was my idea to solve this. It will require the computer to be setup to be fully encrypted however.

The auto login users keyring password will be stored and be encrypted using the system encrypted password. When the computer is booted up and unlocked, it will decrypt the keyring password and use that to unlock the users keyring when logging into the user.

This way the keyring gets unlocked but the keyring password is stored secure and not in plain text.


Not sure the best place to make this feature request? Debain github repo perhaps?

[–] trymeout@lemmy.world 1 points 2 years ago (3 children)
 

Ubuntu is great but uses snaps and adds other canonical bits. Linux Mint is essentially perfect but does not come with gnome desktop. Is there a ubuntu based distro that is essentially like linux mint but offers gnome as a desktop?

 

What does the -d mean in the run command?

docker run -d -p 3355:3355/tcp -p author/image
 

Are all apps on the IzzyOnDroid F-Droid Repository fully open source? Or are there partially open source apps and closed source apps on the IzzyOnDroid F-Droid Repository?

 

Can you set up a lemmy instance to only federate with lemmy and kbin instances? And not federate with others like peertube, mastodon, etc?

view more: next ›