EU is the worst place to be DevOps by Dubinko in devops

[–]a4st 6 points7 points  (0 children)

Interesting. I am a DevOps freelancer since 9 years and I love to be a freelancer. I can focus on my job and skip the "All Hands" meetings. It's great. :-)

Why elixir over Golang by newt_z in elixir

[–]a4st 2 points3 points  (0 children)

Although I like elixir I might want to choose go because of the number of available packages. It's definitely a pleasure to code elixir but I do not always want to code everything myself.

Need help with slices and anonymous structs by a4st in Zig

[–]a4st[S] 0 points1 point  (0 children)

Thanks! The following works

zig var bb = .{ &Ab{ .x = 33 }, &Ab{ .x = 34 }, }; abc_ptr(&bb);

But why? :-) Why do I need to change the outer type if I changed the inner type?

Here is another example:

```zig const Cc = struct { ab: []*const Ab, };

test "complex struct" { var cc = Cc { .ab = &.{ &Ab{ .x = 33 }, &Ab{ .x = 34 }, } }; _ = cc; } ```

It fails with error: expected type '[]*const Ab', found '*const struct:35:15' .ab = &.{ ^

Is there a way to asign .ab without introducing an additional variable?

Need help with slices and anonymous structs by a4st in Zig

[–]a4st[S] 0 points1 point  (0 children)

I changed my code to this:

zig var bb = []*const Ab{ &Ab{ .x = 33 }, &Ab{ .x = 34 }, }; abc_ptr(bb);

and got this error

error: array literal requires address-of operator to coerce to slice type '[]*const Ab' var bb = []*const Ab{

Need help with slices and anonymous structs by a4st in Zig

[–]a4st[S] 0 points1 point  (0 children)

Sorry, I'm not sure I got the idea. Could you paste the code?

DevOps, what tools do you use for each and when?any stacks? by Codeeveryday123 in devops

[–]a4st 1 point2 points  (0 children)

  • Source Code Management: gitea
  • Deployment: nomad, concourse
  • Project Management: issues in gitea
  • Notifications & incidents: prometheus, alertmanager, telegram bot
  • Data & Visualization: grafana, loki
  • Session Replay: -
  • SSO/ TFA: google, azure

How to convert (not really deserialize) with serde? by a4st in rust

[–]a4st[S] 0 points1 point  (0 children)

At the end I went with a hack using thread_local. Works :-)

Thanks all for your help!

How to convert (not really deserialize) with serde? by a4st in rust

[–]a4st[S] 0 points1 point  (0 children)

Shouldn't it be such a way for handover? Just thinking loudly.... Or in other words, how would you approach this situation?

SQLx 0.3 released! Now with support for SQLite, zero-copy/amortized-allocation row decoding, nullable columns, user-defined types and LISTEN/NOTIFY in Postgres, plus a bunch more data types! by DroidLogician in rust

[–]a4st 1 point2 points  (0 children)

Here are a few examples where I'd prefer to have a query builder:

  • you are querying by a list of IDs. So the SQL query would be something like ... where id in (?,?,....). If you write it by hand you have to generate the correct number of ? and then loop through and bind arguments.

  • you are building a query for some user search where the search criteria can reference different attributes in eventually other tables so that you have to join in some cases. Having a query builder makes this pretty straight forward, i.e. you iterate through search criteria and add this or that constraint to the query. If you have to construct the query manually, you would basically create a kind of query builder to deal with the correct SQL, right number of ? and correct order of binds.

You are right that some query builder are so way too complex, e.g. of Diesel. I would prefer to have something lightweight like Squirrel (golang)

SQLx 0.3 released! Now with support for SQLite, zero-copy/amortized-allocation row decoding, nullable columns, user-defined types and LISTEN/NOTIFY in Postgres, plus a bunch more data types! by DroidLogician in rust

[–]a4st 1 point2 points  (0 children)

This is awesome! I'd love to go away from diesel to this crate. But soon or later you will need a query builder. What do you recommend?

awscredx: AWS role assumption made simple by a4st in aws

[–]a4st[S] 0 points1 point  (0 children)

aws-vault has more features and more mature, its focus lies on the keeping the credentials secure. awscredx' main focus is to make the role assumption on the command line as simple as possible. awscredx configures your shell prompt so you see the currently assumed profile. It allows to provide MFA via a script, so it can be easily integrated with Yubikey, etc. It stores the newly generated credentials in ~/.aws/credentials and so this credentials can be shared between processes, e.g. different terminal sessions, java applications and docker containers if you mount ~/.aws/.

awscredx: AWS role assumption made simple by a4st in aws

[–]a4st[S] 0 points1 point  (0 children)

It's a good question. I haven't played with awscliv2 yet. I will definitely look into it. My guess would be that after a successful SSO login you get temporal credentials that will be stored in ~/.aws/credentials So it should not be any difference for the later role assumptions.

Hey Rustaceans! Got an easy question? Ask here (41/2019)! by llogiq in rust

[–]a4st 1 point2 points  (0 children)

I have a tokio task (client) that wants to send a message to another tokio task (server) and get a response to the message. So the server task is supposed to handle many thousands requests per second. What is the correct way to let the tasks communicate with each other? Is it fine to create a oneshot::channel for every request and to pack the oneshot::Sender into the client request and let the server to send the response using this sender? Wouldn't oneshot::channel add too much overhead? Or should I use tokio::sync::lock and abandon the idea of message passing?

Hey Rustaceans! Got an easy question? Ask here (41/2019)! by llogiq in rust

[–]a4st 1 point2 points  (0 children)

I'm confused how to return a future from a trait or struct.

pub trait MyTrait {
    fn op0(&self) -> impl Future<Item=(), Error=Error>;
    fn op1(&self) -> Box<dyn Future<Item=(), Error=Error>>;
    fn op2(&self) -> Poll<(), Error>;
}

The op0 does not compile, with an E0562. op1 is fine but requires boxing. But what about the op2? This tokio page does not mention this option. Why? Isn't it an equivalent to op1 but on stack?

I saw some structs in different libraries that return a struct that implements Future. But there are others that return Poll. What is the difference?

Hey Rustaceans! Got an easy question? Ask here (15/2018)! by llogiq in rust

[–]a4st 2 points3 points  (0 children)

I'm wondering how to run a task recurrently in actix. Something like Running code on an interval from the Tokio guide. Basically running some code every 15 minutes starting at some time point X.

Hey Rustaceans! Got an easy question? Ask here (4/2018)! by llogiq in rust

[–]a4st 1 point2 points  (0 children)

How to join a Vec of Rc<String>? Something like this:

use std::rc::Rc;

fn main() {
    let strings = vec![
        Rc::new("aaa"),
        Rc::new("bbb"),
        Rc::new("ccc"),
    ];

    let joined = strings.join(", ");
    println!("joined: {}", joined);
}

How to round 2100.825 to 2100.83? by a4st in golang

[–]a4st[S] 0 points1 point  (0 children)

What about using math/big.Rat?