trymeout

joined 1 year ago
[–] trymeout@lemmy.world 0 points 2 weeks 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 2 weeks 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 2 months ago

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

[–] trymeout@lemmy.world 1 points 3 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 3 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 8 months 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 11 months 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 1 year 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?

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

Otherwise -d does nothing different to the container, just runs the container "in the background" so you can continue entering other commands in the terminal without having to open another terminal tab or terminal window?

[–] trymeout@lemmy.world 2 points 1 year ago (4 children)

What does detach mode do?

 

What does the -d mean in the run command?

docker run -d -p 3355:3355/tcp -p author/image
[–] trymeout@lemmy.world 2 points 1 year ago

https://github.com/ivpn/desktop-app/issues/290

I made this feature request to IVPN. I doubt IVPN will make it happen but I also did it to get the idea out there. I do think IVPN clients are the best FOSS VPN clients on the market and the idea was to fork IVPN desktop and mobile clients and modify them to bee these universal VPN clients were any VPN provider can integrate these clients into their service. This way a user can subscribe to a few or several VPN providers and access them all in one client, easy to add providers in the client. All a user needs to do is add a URL or IP address in the subscription settings of the VPN client, and login to the VPN account and from there the VPN client will import the VPN servers that VPN providers has and always keep them up to date when the VPN providers adds or remove servers.

Also such an idea will ensure there is a one, secure and fully open source VPN client that works with many VPN providers, and VPN providers do not need to spend time and money developing their own clients for desktop and mobile, and can instead spend time and money on their service and servers. VPN providers can contribute to the universal VPN client if they so wish.

 

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?

 

Can a admin delete every community and its posts from an instance on its end? For example, if a instance that was federated to your instance goes offline forever and is not going back online, can the admin delete all communities and posts from that instance that is federated to your instance?

view more: next ›