Searching yarn

Twts matching #C
Sort by: Newest, Oldest, Most Relevant

On the topic of Programming Languages and Telemetry. I’m kind of curious… Do any of these programming language and their toolchains collect telemetry on their usage and effectively “spy” on your development?

  • Python
  • C
  • C++
  • Java
  • C#
  • Visual Basic
  • Javascript
  • SQL
  • Assembly Language
  • PHP

⤋ Read More
In-reply-to » @prologic @movq this is the default behavior of pass on my machine:

@abucci@anthony.buc.ci So.. The issue is that its showing the password by default? Would making an alias to always include the -c help? We can probably engage Jason with a PR to enable a more hardened approach when desired. I’ve spoken to him before and is generally a pretty open to ideas.

I found this app that was created by the gopass author that does copy by default and has a tui or GUI mode https://github.com/cortex/ripasso

⤋ Read More
In-reply-to » @movq yeah.. i rewrote it a few times because i thought there was something breaking.. but was mistaken though now i am seeing a weird cache corruption.. that seems to come and go. Media

I have found the issue with this very subtle bug.. the cache was returning a slice that would be mutated. The mutation involved appending an item and then sorting. because the returned slice is just a pointer+length the sort would modify the same memory.

          CACHE         Returned slice          
original: [A B C D]     [A B C D]
add:      [A B C D] E   [A B C D E]
sort:     [E A B C] D   [A B C D E]

fix found here:
https://git.mills.io/yarnsocial/yarn/pulls/1072

⤋ Read More

Hoy estuve diseñando una versión solitaria de Saint Poker ♠️♥️♣️♦️.

No funciona tan mal, se siente divertida y te hace pensar de una manera diferente al Hold’em. Posiblemente sea la versión sobre la que hare un tutorial de C# y Unity. La versión Ultimate Poker para casino no la siento tan entretenida.

Me gustaría probar la versión multijugador. Siento que será completamente diferente.

⤋ Read More
In-reply-to » Por aquí en america de Norte (llamado Canada), es muy dificil para las autos, los inviernos y las distancia los rompen todos.

¿Vives en Canadá 🇨🇦? Suena demasiado frio para mí 🥶 Mi hermano quería ir allá a trabajar, y tengo algunos amigos, pero con mi frío de 8° C ya me estoy congelando aquí al norte de México!

¡Me da mucha curiosidad como pueden soportar los autos tanto frío! Me toco manejar en la nieve en Minnesota, aunque quizás no es tanto como lo que soporta el tuyo…

⤋ Read More

Estoy practicando Ruby con el libro Head First (muy recomendado), y me doy cuenta que es bastante diferente a otros lenguajes que conozco y me gustan como Python, JS, C#. Le estoy apostando sobre Go, PHP y otros. Espero sea buena decisión

⤋ Read More
In-reply-to » Progress! so i have moved into working on aggregates. Which are a grouping of events that replayed on an object set the current state of the object. I came up with this little bit of generic wonder.

(cont.)

Just to give some context on some of the components around the code structure.. I wrote this up around an earlier version of aggregate code. This generic bit simplifies things by removing the need of the Crud functions for each aggregate.

Domain Objects

A domain object can be used as an aggregate by adding the event.AggregateRoot struct and finish implementing event.Aggregate. The AggregateRoot implements logic for adding events after they are either Raised by a command or Appended by the eventstore Load or service ApplyFn methods. It also tracks the uncommitted events that are saved using the eventstore Save method.

type User struct {
  Identity string ```json:"identity"`

  CreatedAt time.Time

  event.AggregateRoot
}

// StreamID for the aggregate when stored or loaded from ES.
func (a *User) StreamID() string {
	return "user-" + a.Identity
}
// ApplyEvent to the aggregate state.
func (a *User) ApplyEvent(lis ...event.Event) {
	for _, e := range lis {
		switch e := e.(type) {
		case *UserCreated:
			a.Identity = e.Identity
			a.CreatedAt = e.EventMeta().CreatedDate
        /* ... */
		}
	}
}
Events

Events are applied to the aggregate. They are defined by adding the event.Meta and implementing the getter/setters for event.Event

type UserCreated struct {
	eventMeta event.Meta

	Identity string
}

func (c *UserCreated) EventMeta() (m event.Meta) {
	if c != nil {
		m = c.eventMeta
	}
	return m
}
func (c *UserCreated) SetEventMeta(m event.Meta) {
	if c != nil {
		c.eventMeta = m
	}
}
Reading Events from EventStore

With a domain object that implements the event.Aggregate the event store client can load events and apply them using the Load(ctx, agg) method.

// GetUser populates an user from event store.
func (rw *User) GetUser(ctx context.Context, userID string) (*domain.User, error) {
	user := &domain.User{Identity: userID}

	err := rw.es.Load(ctx, user)
	if err != nil {
		if err != nil {
			if errors.Is(err, eventstore.ErrStreamNotFound) {
				return user, ErrNotFound
			}
			return user, err
		}
		return nil, err
	}
	return user, err
}
OnX Commands

An OnX command will validate the state of the domain object can have the command performed on it. If it can be applied it raises the event using event.Raise() Otherwise it returns an error.

// OnCreate raises an UserCreated event to create the user.
// Note: The handler will check that the user does not already exsist.
func (a *User) OnCreate(identity string) error {
    event.Raise(a, &UserCreated{Identity: identity})
    return nil
}

// OnScored will attempt to score a task.
// If the task is not in a Created state it will fail.
func (a *Task) OnScored(taskID string, score int64, attributes Attributes) error {
	if a.State != TaskStateCreated {
		return fmt.Errorf("task expected created, got %s", a.State)
	}
	event.Raise(a, &TaskScored{TaskID: taskID, Attributes: attributes, Score: score})
	return nil
}
Crud Operations for OnX Commands

The following functions in the aggregate service can be used to perform creation and updating of aggregates. The Update function will ensure the aggregate exists, where the Create is intended for non-existent aggregates. These can probably be combined into one function.

// Create is used when the stream does not yet exist.
func (rw *User) Create(
  ctx context.Context,
  identity string,
  fn func(*domain.User) error,
) (*domain.User, error) {
	session, err := rw.GetUser(ctx, identity)
	if err != nil && !errors.Is(err, ErrNotFound) {
		return nil, err
	}

	if err = fn(session); err != nil {
		return nil, err
	}

	_, err = rw.es.Save(ctx, session)

	return session, err
}

// Update is used when the stream already exists.
func (rw *User) Update(
  ctx context.Context,
  identity string,
  fn func(*domain.User) error,
) (*domain.User, error) {
	session, err := rw.GetUser(ctx, identity)
	if err != nil {
		return nil, err
	}

	if err = fn(session); err != nil {
		return nil, err
	}

	_, err = rw.es.Save(ctx, session)
	return session, err
}

⤋ Read More
In-reply-to » Use C do crime! https://cdn.masto.host/pdxsocial/media_attachments/files/107/294/565/215/390/680/original/1d29c85c0aa4c9a5.png

JavaScript : web apps

wut?! 😳 seriously?! 🤦‍♂️

Python : small tools

Okay 👌

Go: micro services

Umm bad generalization 🤣 – Example yarnd that powers most of Yarn.social 😂

Java: enterprise software

Yes! Oh gawd yes! 🤣 And Java™ needs to die a swift death!

C: crimes

Hmmm? 🤔 I feel this one is going to have some backslash and/or go the way of “Hacker” being misconstrued to mean entirely different/incorrect things as is what’s happening in the media (for various definitions of “media”).

⤋ Read More
In-reply-to » Assuming the DNS is playing ball now, my little personal site https://www.andrewjvpowell.com/ is now self hosted and solar powered. As @mckinley can attest, running on the original nearlyfreespeech.net non-production plan could use as little as $0.01 per day so there's not really any advantage to this, its just... because I can 🙃

a simple Makefile for forwarding internet to your local machine:

SSH_HOST=https://xuu.me
PRIV_KEY=~/.ssh/id_ed25519
forward:
	LOCAL_PORT=$(HOST_PORT); sh -c "$(shell http --form POST $(SSH_HOST) pub=@$(PRIV_KEY).pub | grep ^ssh | head -1 | awk '{ print "ssh -T -p " $$4 " " $$5 " -R " $$7 " -i $(PRIV_KEY)"  }')"

⤋ Read More
In-reply-to » My kid just uncovered a bug in a program I wrote by grabbing my laptop and smacking the keyboard a bunch. Biological input fuzzing; a real-life chaos monkey.

“ç”, I think. Anything above 7-bit ASCII would’ve done it, though.

⤋ Read More

@prologic@twtxt.net @jlj@twt.nfld.uk @movq@www.uninformativ.de

 /p/tmp > git clone https://www.uninformativ.de/git/lariza.git                                                                                                    Mon May 24 23:48:18 2021
Cloning into 'lariza'...
 /p/tmp > tree lariza/                                                                                                                                    12.5s  Mon May 24 23:48:32 2021
lariza/
├── BUGS
├── CHANGES
├── LICENSE
├── Makefile
├── PATCHES
├── README
├── browser.c
├── man1
│   ├── lariza.1
│   └── lariza.usage.1
├── user-scripts
│   └── hints.js
└── we_adblock.c

2 directories, 11 files

⤋ Read More