demesisx

joined 2 years ago
MODERATOR OF
[–] [email protected] 5 points 1 month ago (2 children)

Your history is glorious. Thanks for routinely being the only person making actual sense in the comment section. ✊🏽

[–] [email protected] 12 points 1 month ago* (last edited 4 weeks ago)

Joy Ann Reid is considered progressive? 🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣

The news media is lurching FAR to the right and people are REALLLLLLL quiet about it.

Joy Ann Reid was one of the most vocal opponents of Bernie Sanders in 2016. She is the equivalent of JOE LIEBERMAN for news pundits.

[–] [email protected] 7 points 1 month ago

I used to keep a list of repos to pull onto my NAS in case they someday went closed source. I use “mr” for it. It worked great. I had it on a systemd timer.

https://myrepos.branchable.com/

[–] [email protected] 3 points 1 month ago (8 children)

Can confirm.

[–] [email protected] 9 points 1 month ago (1 children)

Yes. They did, after all, assassinate him.

[–] [email protected] 6 points 1 month ago* (last edited 1 month ago) (3 children)

It’s pretty funny to see this thread filled with wrong answers by lemmy.world users and those same smuglibs downvoting anyone that suggests otherwise when it’s pretty universally accepted that he was killed by the CIA.

The CIA even did a distinctive CIA-style cleanup job , eliminating all parties with knowledge of the hit afterward.

What for many years seemed unthinkable has turned out to be true after all.

There was a CIA cover-up. The CIA did suppress information. The CIA did stonewall both of the official government investigations of the JFK assassination. And as a consequence of this Agency misconduct, both investigations were compromised in important respects-particularly in regard to the fundamental issues of whether the assassination resulted from a conspiracy and whether Lee Harvey Oswald (alleged to be the sole assassin in the Warren Report and alleged to be one of multiple assassins in the Report of the House Assassinations Committee) was affiliated with the CIA.

11
UUID in Purescript (infosec.pub)
submitted 3 months ago* (last edited 2 months ago) by [email protected] to c/[email protected]
 

I ran into a situation the other day where UUID was needed. Sadly, the UUID module in pursuit depends on an npm package. So, I rolled my own.

I’d be happy to hear of any holes in my implementation and any other critiques anyone has to offer.

Here’s the code:

module UUID where

import Prelude
import Data.Either (Either(..))
import Data.Int.Bits ((.|.))
import Data.Maybe (Maybe(..))
import Data.String (joinWith, length)
import Data.String.Regex (regex, test)
import Data.String.Regex.Flags (noFlags)
import Effect (Effect)
import Data.Int (floor, hexadecimal, toNumber, toStringAs)
import Effect.Random (random)
import Data.Array (replicate)

newtype UUID = UUID String

instance showUUID :: Show UUID where
  show (UUID uuid) = uuid
derive instance eqUUID :: Eq UUID
derive instance ordUUID :: Ord UUID

randomInt :: Int -> Int -> Effect Int
randomInt min max = do
  r <- random
  pure $ floor $ r * toNumber (max - min + 1) + toNumber min

padStart :: Int -> String -> String
padStart targetLength str =
  let
    paddingLength = max 0 (targetLength - length str) 
    padding = replicate paddingLength "0" 
  in joinWith "" padding <> str


parseUUID :: String -> Maybe UUID
parseUUID str = 
  case regex "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" noFlags of
    Left _ -> Nothing
    Right r -> if test r str
               then Just $ UUID str
               else Nothing

uuidToString :: UUID -> String
uuidToString (UUID uuid) = uuid

emptyUUID :: UUID
emptyUUID = UUID "00000000-0000-0000-0000-000000000000"

-- | Generate a UUID v4
genUUID :: Effect UUID
genUUID = do
  -- Generate random 16-bit integers for smaller chunks
  r1 <- randomInt 0 0xFFFF  -- First half of time_low
  r2 <- randomInt 0 0xFFFF  -- Second half of time_low
  r3 <- randomInt 0 0xFFFF  -- time_mid
  r4 <- randomInt 0 0x0FFF  -- time_hi (12 bits for randomness)
  r5 <- randomInt 0 0x3FFF  -- clock_seq (14 bits for randomness)
  r6 <- randomInt 0 0xFFFF  -- First part of node
  r7 <- randomInt 0 0xFFFF  -- Second part of node
  r8 <- randomInt 0 0xFFFF  -- Third part of node

  -- Set the version (4) and variant (10)
  let versioned = r4 .|. 0x4000  -- Set version to 4 (binary OR with 0100 0000 0000 0000)
      variant = r5 .|. 0x8000    -- Set variant to 10xx (binary OR with 1000 0000 0000 0000)

  -- Convert to hex and pad as needed
  let hex1 = padStart 4 (toHex r1) <> padStart 4 (toHex r2)  -- time_low
      hex2 = padStart 4 (toHex r3)                           -- time_mid
      hex3 = padStart 4 (toHex versioned)                    -- time_hi_and_version
      hex4 = padStart 4 (toHex variant)                      -- clock_seq
      hex5 = padStart 4 (toHex r6) <> padStart 4 (toHex r7) <> padStart 4 (toHex r8) -- node
      uuid = joinWith "-" [hex1, hex2, hex3, hex4, hex5]

  pure $ UUID uuid
  where
    toHex = toStringAs hexadecimal
 

It seems like the ultimate way to show WHY and HOW a company is poorly run… or the inverse.

 

This is an important video for the community. Charles (rightly) raises the alarm about lack of oversight on the Cardano board. Pay close attention. This is how an organization can co-opt an entire protocol.

We need to shore up this lack of community oversight ASAP.

 

#fp #functionalprogramming #purescript #scala

 
 

I refuse to promote a project that isn’t open source. This project claims that it will go open source in 2025 upon mainnet launch.

I have therefore decided to lock this community until that very day.

 

In the process of forking Xmonad, it was discovered that a lot of work would need to be done in getting a Haskell compositor working. Currently, the compositor is being worked on using Tiny-wlhs: A Haskell-Driven Wayland Compositor (Seeking Contributors!)

tiny-wlhs began as an experiment to explore Haskell bindings for wlroots. We took the simple tinywl C compositor and turned it into a Haskell-controlled shared library. This approach lets us incrementally port C code to Haskell while keeping a working window manager. The immediate feedback from a functional compositor is invaluable during development and provides something solid to work with. You can find the project on GitHub: https://github.com/l-Shane-l/tiny-wlhs 25

 

The moment has arrived! ✍️

The signing ceremony is happening now, officially marking the Cardano Constitution as the foundation for a decentralized governance model.

This is a significant achievement, made possible by the collaboration, feedback, and dedication of the global Cardano community.

Thank you to everyone who contributed to this journey.

view more: ‹ prev next ›