13

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.

12

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.

135
submitted 1 month ago by trymeout@lemmy.world to c/opensource@lemmy.ml

I hope this project gets more contributors to help make it as good or better than Newpipe. Written in Dart using Flutter can allow it to be compiled for Android, iOS and desktop

7
submitted 3 months ago* (last edited 3 months ago) by trymeout@lemmy.world to c/linux4noobs@programming.dev

I was able to setup a debugger using a launch mode using Visual Studio Code with the Bash Debug extension. Is it possible to setup the debugger in VSCode to be able to debug a bash script using a attach debug mode?

For debugging scripts on the host machine and scripts inside a docker container?

[-] trymeout@lemmy.world 3 points 3 months ago

VSCodium > VSCode

1
submitted 3 months ago by trymeout@lemmy.world to c/browsers@lemmy.ml
1
submitted 3 months ago by trymeout@lemmy.world to c/css@programming.dev

When I use the --sourcemap argument in the CLI to generate the CSS builds with sourcemaps, when the CSS uses @include, it does not update the path and therefore will not work.

In the code below, the builds are stored in the dist directory, while the CSS source code is stored in the src directory.

This is my simple code to reproduce this...

- src/
   - stylesheet.css
- dist
   - my-package.css
   - my-package.css.map
- demo.html
- bundle.css
- package.json

bundle.css

@import 'src/stylesheet.css';

demo.html

<link rel="stylesheet" href="dist/my-package.css">

package.json

{
  "name": "my-package",
  "version": "1.0.0",
  "license": "MIT",
  "scripts": {
   "build": "lightningcss --sourcemap bundle.css -o dist/my-package.css"
  },
  "devDependencies": {
    "lightningcss-cli": "^1.25.1"
  }
}

src/stylesheet.css

body {
	background-color: red;
}

dist/my-package.css output

@import "src/stylesheet.css";

/*# sourceMappingURL=dist/my-package.css.map */

What I expected from the dist/my-package.css output

@import "../src/stylesheet.css";

/*# sourceMappingURL=dist/my-package.css.map */

Does anyone know why this is the outcome? Any help will be most appreciated.

[-] trymeout@lemmy.world 3 points 5 months ago* (last edited 5 months ago)

I think stablecoins will always have a centralized point of failure. Weather it is an algorithm, or having the coin backed by the actual asset.

I think the best stablecoins are backed by the asset 1 to 1 or a little more then 1 to 1. Most stablecoins that do this are token on smart chain contracts which have another vulnerability which is being a smart contract. Smart contracts could contain a vulnerability and if it does have a vulnerability, a new contract will need to be made and users will have to switch their old token to the new tokens. Also censorship is an issue. https://cryptonews.com/news/tether-takes-action-blacklists-validator-address-linked-25-million-mev-bot-drain-heres-what-happened.htm

And these stablecoins are not private. The only private stablecoin platform out there is Haven but Haven assets are not backed 1 to 1.

I hope there are plently of stablecoins issued on Zano in the future. Zano allows you to create an asset without creating a smart contract. All assets on Zano are private. I would like to see Tether, USDC and other issue stablecoins on Zano. Trusting the issuers on backing the stablecoin and trusting the issuer to secure their private keys to prevent hackers from inflating the asset will be the only vulnerabilities, but you will have privacy and a censorship resistant stablecoin!

[-] trymeout@lemmy.world 6 points 5 months ago

https://github.com/AgoraDesk-LocalMonero/agoradesk-app-foss/issues/296

Please upvote this issue if you want to see all the source code for AgoraDesk/LocalMonero be released!

20
submitted 5 months ago by trymeout@lemmy.world to c/monero@monero.town

AgoraDesk/LocalMonero is shutting down 😞

Their app is fully open source and is a slick app written in Flutter.

Upvote this request on their github if you show interest in AgoraDesk/LocalMonero in releasing all of their source code for the back end as well. It is a long shot but if AgoraDesk/LocalMonero is going to shutdown, maybe they will release their source code to allow someone else to launch a new P2P trading platform that is a fork of AgoraDesk/LocalMonero and can do so with less work.

11
Do we need Live Reload (Watch) in bundlers? (marketplace.visualstudio.com)

Do we need live reload feature in bunders? Couldn't we just use this extension for Visual Studio Code or simular features and extensions in other IDEs which will execute a custom command of your choice when you save a file with a certain file extension in your IDE?

https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave

This extensions allows you to customize the commands to execute in saving a file in your global VSCode settings and in the VSCode workspace settings .vscode/settings.json, allowing others to use the same configuration in group projects.

Lightning CSS does not have a live reload feature and the live reload feature in Rollup cannot handle watching many files, however using this extension in VSCode, will not watch files but run the npm run dev:css or npm run dev:js command when saving a css or js file without watching for files to change.

One downside I see with this is when working on a project with others who are using different IDEs that do not support this feature. Besides that, is there any downsides to this approach?

15

Is there an easy way to enable a inactivity timer when using a TTY like in Ubuntu Server for when there has been no inactivity for X seconds, it will execute vlock and lock the TTY.

15

On Ubuntu Server and Arch I was able to change the following line in /lib/systemd/system/getty@.service

# Before
ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear %I $TERM


# After
ExecStart=-/sbin/agetty --noissue --autologin john %I $TERM Type=idle

And it works, that it will login to the user john but when I logout of the user john with using exit in the terminal, it logs john back in. Is there a way to change this ExecStart setting to enable auto login for a user on startup but only on startup?

5

When using dependencies such as NPM packages, Composer packages. Weather you use a CDN or host the packages on the web server, don't many packages out there require you to display the licenses of the package being used and show attributions?

How would one place this on their website? I even went to several websites to see how they do this and could not find a section and I am sure these website use packages that require the license to be listed and list the attributions.

I can find the licenses and attributions of packages used in many applications on desktop and mobile, usually in the apps "about" page.

12

I have gotten Wake On LAN (WOL) setup and working. However my machine is a Ubuntu machine using full disk LUKS encryption which means when booting it up, it requires a password/passphrase to unlock the machine before it boots into Ubuntu. The WOL systemD service I created will always make sure WOl is enabled for the next time the machine reboots, however if I reboot the machine and fail to unlock the device on the full disk encryption menu and the machine shut down, WOL will not be enabled which means WOL is not going to work to turn on the machine again.

Is there a way to enable WOL on the system full disk LUKs encryption lock screen?

[-] trymeout@lemmy.world 19 points 8 months ago* (last edited 8 months ago)

Please add the crypto addresses to the site sidebar under donations. You also may want to consider accepting BTC, BCH and LTC. Glad your accepting XMR though for private donations.

[-] trymeout@lemmy.world 58 points 8 months ago* (last edited 8 months ago)

Discord is the worst. Requires a phone number, does not allow email aliases and logs your chats.

Matrix and SimpleX is way better

[-] trymeout@lemmy.world 4 points 11 months ago

I was thinking it would look like the steam deck but have a hdmi port (or usb-c port) for video and audio (or at least video) and a regular usb port for the controller. I am fine with being tethered to my pc since I can get long cords and I would prefer do use this monitor and controller without batteries if possible.

I will check out the portable monitors and see if I can make it work. My goal is to game in my bed before bedtime and I do not want to buy a big TV in my room just to have a clear picture.

[-] trymeout@lemmy.world 4 points 1 year ago

I wish session remade their client with flutter and made it feature rich like Element/Jami/SimpleX.

I like how sessions handles users IDs as seed phrases and also wishes sessions will allow you to manage multiple user IDs from a single seed phrase.

Nostr FTW!

[-] trymeout@lemmy.world 24 points 1 year ago

Karma system was a horrible feature on reddit.

[-] trymeout@lemmy.world 9 points 1 year ago

What country is lemmy.world hosted in?

[-] trymeout@lemmy.world 7 points 1 year ago

Could Threads essentially cause a kinda DDOS attack onto other instances or bloating other instances with data?

[-] trymeout@lemmy.world 2 points 1 year ago

Does the mastodon instance need to be up to date for it to work?

view more: next ›

trymeout

joined 1 year ago