Feed

Reactions, reposts, notes, webmnetions

LogSeq - notes taking application

Found this interesting project called LogSeq.

Its hardcore, privacy-first notes taking app, knowledge base, might be even compared to org-roam.

Features

  • Markdown, Wiki-alike, Plain text format
  • Local first which means it saves everything locally, and if you want it can synchronize
  • Mobile App for both platforms iOS/Android
  • Obsidian like intrerface with interlinking and visual graph
  • It’s org-mode inspired, supports org-mode formatting
  • Plugins market place with various plugins

Probably will be most popular tool after Obsidian for average ppl very soon.

https://hub.logseq.com/getting-started/uQdEHALJo7RWnDLLLP7uux/an-overview-of-50-logseq-features/jn3RC9eBF3ofpjaLtxXrDe

https://logseq.com/

Benchmarks code for CPU testing

Various benchmarks to launch to load CPU

https://benchmarksgame-team.pages.debian.net/benchmarksgame/

Ruby Example:

# The Computer Language Benchmarks Game
# https://salsa.debian.org/benchmarksgame-team/benchmarksgame/
# Contributed by Wesley Moxam
# Modified by Sokolov Yura aka funny_falcon
# Parallelised by Scott Leggett
# Thread.exclusive deprecated

require 'thread'

module MiniParallel
    class Worker
        def initialize(read, write)
            @read, @write = read, write
        end

        def close_pipes
            @read.close
            @write.close
        end

        def work(index)
            Marshal.dump(index, @write)
            Marshal.load(@read)
        end
    end

    def self.map(array, &block)
        work_in_processes(
            array,
            [array.size, core_count].min,
            &block
        )
    end

    def self.core_count
        @@core_count ||= IO.read("/proc/cpuinfo").scan(/^processor/).size
    end

    private

    def self.work_in_processes(array, count, &block)
        index = -1
        results, threads = [], []
        mx = Mutex.new        

        workers = create_workers(array, count, &block)

        workers.each do |worker|
            threads << Thread.new do
                loop do
                    mx.synchronize do index += 1 end
                    break if index >= array.size
                    results[index] = worker.work(index)
                end
                worker.close_pipes
            end
        end

        threads.each(&:join)
        Process.waitall

        results
    end

    def self.create_workers(array, count, &block)
        workers = []
        count.times do
            workers << create_worker(array, workers, &block)
        end
        workers
    end

    def self.create_worker(array, started_workers, &block)
        child_read, parent_write = IO.pipe
        parent_read, child_write = IO.pipe

        Process.fork do
            started_workers.each(&:close_pipes)

            parent_write.close
            parent_read.close

            process_incoming_jobs(child_read, child_write, array, &block)

            child_read.close
            child_write.close
        end

        child_read.close
        child_write.close

        Worker.new(parent_read, parent_write)
    end

    def self.process_incoming_jobs(read, write, array, &block)
        until read.eof?
            index = Marshal.load(read)
            Marshal.dump(block.call(array[index]), write)
        end
    end
end

class Fannkuch

    def initialize(n, start, max_perms)
        @n = n
        @p = (0..n).to_a
        @s = @p.dup
        @q = @p.dup
        @sign = 1
        @sum = @maxflips = 0
        @max_perms = max_perms
        @perm_count = -start
        start.times{permute}
    end

    def flip
        loop do
            if @perm_count == @max_perms
                return [@sum, @maxflips]
            end
            if (q1 = @p[1]) != 1
                @q[0..-1] = @p
                flips = 1
                until (qq = @q[q1]) == 1
                    @q[q1] = q1
                    if q1 >= 4
                        i, j = 2, q1 - 1
                        while i < j
                            @q[i], @q[j] = @q[j], @q[i]
                            i += 1
                            j -= 1
                        end
                    end
                    q1 = qq
                    flips += 1
                end
                @sum += @sign * flips
                @maxflips = flips if flips > @maxflips # New maximum?
            end
            permute
        end
    end

    def permute
        @perm_count += 1

        if @sign == 1
            # Rotate 1<-2.

            @p[1], @p[2] = @p[2], @p[1]
            @sign = -1
        else
            # Rotate 1<-2 and 1<-2<-3.

            @p[2], @p[3] = @p[3], @p[2]
            @sign = 1
            i = 3
            while i <= @n && @s[i] == 1
                @s[i] = i
                # Rotate 1<-...<-i+1.

                t = @p.delete_at(1)
                i += 1
                @p.insert(i, t)
            end
            @s[i] -= 1  if i <= @n
        end
    end
end

abort "Usage: #{__FILE__} n\n(n > 6)" if (n = ARGV[0].to_i) < 6

core_count = MiniParallel.core_count
chunk_size = (1..n).reduce(:*) / core_count

sum, flips =
    if core_count > 1
        # adjust job sizes to even out workload
        weights = if core_count > 1
                      weights = []
                      (core_count/2).times do |i|
                          weights << i * 0.1 + 0.05
                      end
                      weights = weights.reverse + weights.map{|i|-i}
                  else
                      [0]
                  end

        # Generate start position for each chunk
        chunks = core_count.times.zip(weights).map do |count, weight|
            [count * chunk_size +
             (count > 0 ? (weights[0,count].reduce(:+) * chunk_size).round : 0),
             chunk_size + (weight * chunk_size).round]
        end

        chunk_results =
            if (RUBY_PLATFORM == 'java')
                chunk_collector = []
                threads = []
                chunks.each.with_index do |(start,weighted_size),i|
                    threads << Thread.new do
                        chunk_collector[i] = Fannkuch.new(n,start,weighted_size).flip
                    end
                end
                threads.all?(&:join)
                chunk_collector
            else
                MiniParallel.map(chunks) do |start, weighted_size|
                    Fannkuch.new(n,start,weighted_size).flip
                end
            end

        chunk_results.reduce do |memo, (cksum, fmax)|
            [memo[0] + cksum, [memo[1], fmax].max]
        end
    else
        Fannkuch.new(n,0,chunk_size).flip
    end

printf "%d\nPfannkuchen(%d) = %d\n", sum, n, flips

Debian 30 years behind

https://bits.debian.org/2023/08/debian-turns-30.html

I am using Debian since later "Potato" distribution. Debian is one of the good distribution back in the time, today is even better. Take a look at this newsgroup message from Ian Murdock this is how Debian was created.

From portal!imurdock Mon Aug 16 06:31:03 1993
Newsgroups: comp.os.linux.development
Path: portal.imurdock
From: imurdock@shell.portal.com (Ian A Murdock)
Subject: New release under development; suggestions requested
Message-ID: <CBusDD.MIK@unix.portal.com>
Sender: news@unix.portal.com
Nntp-Posting-Host: jobe.unix.portal.com
Organization: Portal Communications Company -- 408/973-9111 (voice) 408/973-8091 (data)
Date: Mon, 16 Aug 1993 13:05:37 GMT
Lines: 86

Fellow Linuxers,

This is just to announce the imminent completion of a brand-new Linux release,
which I'm calling the Debian Linux Release. This is a release that I have put
together basically from scratch; in other words, I didn't simply make some
changes to SLS and call it a new release. I was inspired to put together this
release after running SLS and generally being dissatisfied with much of it,
and after much altering of SLS I decided that it would be easier to start
from scratch. The base system is now virtually complete (though I'm still
looking around to make sure that I grabbed the most recent sources for
everything), and I'd like to get some feedback before I add the "fancy" stuff.

Please note that this release is not yet completed and may not be for several
more weeks; however, I thought I'd post now to perhaps draw a few people out
of the woodwork. Specifically, I'm looking for:

1) someone who will eventually be willing to allow me to upload the
release to their anonymous ftp-site. Please contact me.
Be warned that it will be rather large :)

2) comments, suggestions, advice, etc. from the Linux community. This
is your chance to suggest specific packages, series, or
anything you'd like to see part of the final release.

Don't assume that because a package is in SLS that it will necessarily be
included in the Debian release! Things like ls and cat are a given, but if
there's anything that's in SLS that you couldn't live without please let me
know!

I'd also like suggestions for specific features for the release. For example,
a friend of mine here suggested that undesired packages should be selected
BEFORE the installation procedure begins so the installer doesn't have to
babysit the installation. Suggestions along that line are also welcomed.

What will make this release better than SLS? This:

1) Debian will be sleeker and slimmer. No more multiple binaries and
manpages.
2) Debian will contain the most up-to-date of everything. The system
will be easy to keep up-to-date with a 'upgrading' script in
the base system which will allow complete integration of
upgrade packages.
3) Debian will contain a installation procedure that doesn't need to
be babysat; simply install the basedisk, copy the distribution
disks to the harddrive, answer some question about what
packages you want or don't want installed, and let the machine
install the release while you do more interesting things.
4) Debian will contain a system setup procedure that will attempt to
setup and configure everything from fstab to Xconfig.
5) Debian will contain a menu system that WORKS... menu-driven
package installation and upgrading utility, menu-driven
system setup, menu-driven help system, and menu-driven
system administration.
6) Debian will make Linux easier for users who don't have access to the
Internet. Currently, users are stuck with whatever comes with
SLS. Non-Internet users will have the option of receiving
periodic upgrade packages to apply to their system. They will
also have the option of selecting from a huge library of
additional packages that will not be included in the base
system. This library will contain packages like the S3
X-server, nethack and Seyon; basically packages that you and I
can ftp but non-netters cannot access.
7) Debian will be extensively documented (more than just a few
READMEs).
8) As I put together Debian, I am keeping a meticulous record of
where I got everything. This will allow the end-user to
not only know where to get the source, but whether or not
the most recent version is a part of Debian. This record
will help to keep the Debian release as up-to-date as possible.
9) Lots more, but I'll detail later...

Anyway, I'll provide more specifics in a week or so after I receive enough
replies.

Please, all replies by mail. I'll post a followup. If you wish to discuss
this in the newsgroup, please don't turn it into a flamewar. :)

Until later,

Ian
--
Ian Murdock                              Internet: imurdock@shell.portal.com
The Linux Warehouse

Ancient english helps closing PRs // Github

I’ve tried to use this ancient english message as a comment for PR review to bring attention

I bid thee good tidings. I beseech thee to take heed, for lo, several moons have waxed and waned since this comment hath been inscribed, yet it remaineth unresolved. I humbly beseech thee to attend to this matter forthwith, that we may advance the pull request without further delay.

After this message PR was closed, and even branch was deleted due to its obsolete.

Agile clown show // Linkedin

The Agile coaching industry has become a parody of itself because of #agileclownshow, using buzzwords without actually providing any substantial value. It's as if they claim to know the solution to a problem but have no understanding of the problem itself. The issue with Agile coaching is not just the lack of expertise, but also the audience and those in charge. Just as a teacher must have experience in a subject to effectively teach it, an Agile coach must have experience in the business world. Simply put, they must have a track record of producing results, both positive or negative, before they can effectively coach anyone. If not then red nose and fancy hair should be the working suit.

Even more horrible is the fact that agileclowns make new agileclowns each show performed.

How to sign VirtualBox kernel modules when you're on secure boot

When you’re installing VirtualBox on a system with Secure Boot enabled, the installation process requires kernel modules to be loaded that are not signed by the system’s Secure Boot key. In this situation, you have two options:

  1. Disable Secure Boot in BIOS: This option involves going into the system’s BIOS settings and disabling Secure Boot. This will allow the installation process to proceed without any further intervention.

  2. Sign the kernel modules: If you prefer to keep Secure Boot enabled, you can sign the required kernel modules with a key that is trusted by the system’s Secure Boot infrastructure. This involves generating a new key pair, importing the public key into the system’s key store, and using the private key to sign the kernel modules.

Create new key and enroll it with MOK

1
2
3
4
sudo mkdir -p /var/lib/shim-signed/mok
sudo openssl req -nodes -new -x509 -newkey rsa:2048 -outform DER -addext "extendedKeyUsage=codeSigning" -keyout /var/lib/shim-signed/mok/MOK.priv -out /var/lib/shim-signed/mok/MOK.der
sudo mokutil --import /var/lib/shim-signed/mok/MOK.der
sudo reboot

Sign modules with new Key

1
2
3
4
5
6
7
#!/bin/bash 
for modfile in $(dirname $(modinfo -n vboxdrv))/*.ko.xz; do
     echo "Signing $modfile"
     /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 \
             /root/signed-modules/MOK.priv \
             /root/signed-modules/MOK.der "$modfile"
done

The steps you’ve outlined above describe how to perform the second option. The script you’ve provided will sign all the VirtualBox kernel modules that are present on the system. Once the modules have been signed, they will be allowed to load by the system’s Secure Boot infrastructure.

It’s worth noting that signing kernel modules is a security-sensitive operation, and you should take appropriate precautions to protect the key material. Also, the exact steps for signing kernel modules may vary depending on the distribution and version of Linux you’re using.

Done.

Teams vs Slack

Slack has become the industry standard for modern developers’ communities, but Microsoft Teams has emerged as a challenger. However, what exactly does Teams offer, and why is it considered inferior?

The main reason is that Teams did not commit to conducting research on what is needed to facilitate effective communication in a rapidly growing environment. This lack of attention to detail is evident in certain elements of the interface.

Let’s start with the roster, which is a list of available chat entities and users. In Slack, it is streamlined and designed with use cases in mind, while in Teams, it is merely a simulacrum.

For instance:

  • In Slack, finding a chat only requires one click, while in Teams, you need to switch between group chats and private chats, which can be slow.
  • Slack has a well-designed interface for threads, making them easy to see and use. In contrast, Teams has a bloated and poorly functioning mechanism that is difficult to use.
  • In Slack, there is one roster for all chats, while in Teams, there are several different rosters for everything, which does not aid productivity.
  • The chat window and input area in Slack are simple yet sophisticated, while in Teams, they are overly complex and confusing.
  • Code pasting is impossible to do smoothly in Teams, whereas Slack allows for seamless pasting by simply inputting standard markdown backticks. Additionally, Teams do not differentiate between one backtick and triple backticks and does not change highlighting styles.
  • After pasting a message in Teams, the interface can cause the message to appear out of order and even before the previous message.

So why is Teams inferior to Slack? The main reason is that Teams has not invested enough in conducting research and designing an interface that is user-friendly and efficient. Slack, on the other hand, has a well-designed interface that is tailored to the needs of developers, making it the preferred choice in the industry.

Although I am not an advocate for Slack, I believe that Teams is a subpar platform that is not yet ready for production use. While it has many integrations and functionalities, it appears as though they were simply created to imitate Slack and give the impression that “Yes, we have that too.”

Rails 7 introduce default healthcheck controller

DHH introduce default HealthCheckController for Rails 7 ♦

Which is just this piece of code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

class Rails::HealthController < ActionController::Base # :nodoc:
  rescue_from(Exception) { render_down }

  def show
    render_up
  end

  private
    def render_up
      render html: html_status(color: "green")
    end

    def render_down
      render html: html_status(color: "red"), status: 500
    end

    def html_status(color:)
      %(<html><body style="background-color: #{color}"></body></html>).html_safe
    end
end

PR https://github.com/rails/rails/pull/46936

Change colorscheme for code blocks highlighting

Code here is highlighted with https://github.com/mzlogin/rouge-themes1, I changed scheme a bit, now it looks brighter.

Here is the Python method example

1
2
def python():
    puts("Python method example")

Thats for Javascript

1
2
3
4
function test() {
    let sh = 1;
    console.log(sh);
}

PHP

1
2
3
4
5
class Testing {
    function __constructor() {
        $this->a = date('r');
    }
}

Rust

1
2
3
4
5
6
7
fn main() {
    // Statements here are executed when the compiled binary is called

    // Print text to the console
    println!("Hello World!");
}