NixOS config

Zsh, 4

.

# Edit this configuration file to define what should be installed on your system.  Help is available in the configuration.nix(5) man page and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Bootloader.
  boot.loader.grub.enable = true;
  boot.loader.grub.device = "/dev/sda";
  boot.loader.grub.useOSProber = true;

  networking.hostName = "hi"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
  networking.wireless.enable = false;
  hardware.bluetooth.enable = false;

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "Australia/Perth";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_GB.UTF-8";
    LC_IDENTIFICATION = "en_GB.UTF-8";
    LC_MEASUREMENT = "en_GB.UTF-8";
    LC_MONETARY = "en_GB.UTF-8";
    LC_NAME = "en_GB.UTF-8";
    LC_NUMERIC = "en_GB.UTF-8";
    LC_PAPER = "en_GB.UTF-8";
    LC_TELEPHONE = "en_GB.UTF-8";
    LC_TIME = "en_GB.UTF-8";
  };

  # Enable the X11 windowing system.
  services.xserver.enable = true;

  # Enable the KDE Plasma Desktop Environment.
  services.xserver.displayManager.sddm.enable = true;
  services.xserver.desktopManager.plasma5.enable = true;

  # Configure keymap in X11
  services.xserver = {
    layout = "us";
    xkbVariant = "";
  };

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Enable sound with pipewire.
  sound.enable = true;
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    # If you want to use JACK applications, uncomment this
    #jack.enable = true;

    # use the example session manager (no others are packaged yet so this is enabled by default, no need to redefine it in your config for now)
    #media-session.enable = true;
  };

  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.hi = {
    isNormalUser = true;
    description = "hi";
    extraGroups = [ "networkmanager" "wheel" "vboxsf" "vboxusers"];
    shell = pkgs.zsh;
    packages = with pkgs; [
      firefox
      kate
      thunderbird
      chromium
    ];
  };

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # virtualisation.virtualbox.guest.enable = true;
  # virtualisation.virtualbox.guest.x11 = true;
  # virtualisation.virtualbox.host.enable = true;
  # virtualisation.virtualbox.host.enableExtensionPack = true;

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
  #  vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
  #  wget
    zsh
    zsh-autosuggestions
    zsh-syntax-highlighting
    zsh-powerlevel10k
    meslo-lgs-nf

    oh-my-zsh
    corefonts
    fira
    powerline-fonts
    ubuntu_font_family
    unifont

    p7zip
    unrar
    unzip

    util-linux
    meld

    home-manager

    git
    git-cola
    github-desktop

    emacs29

    autokey
    virtualbox
    librewolf
    palemoon-bin
    ventoy-full

    flatpak
    steam
    libsForQt5.falkon
    libsForQt5.korganizer
    krusader

    psensor
    playonlinux
    protonvpn-gui

    # vmware-workstation

    quickemu
    quickgui

    neofetch
  ];

  # Some programs need SUID wrappers, can be configured further or are   # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  programs.zsh = {
    enable = true;
    enableCompletion = true;
    autosuggestions.enable = true;
    interactiveShellInit = ''
      source /run/current-system/sw/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
      source /run/current-system/sw/share/zsh-autosuggestions/zsh-autosuggestions.zsh
      source /run/current-system/sw/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
    '';
  };

  fonts = {
    fontDir.enable = true;
    packages = with pkgs; [
      corefonts
      fira
      powerline-fonts
      ubuntu_font_family
      unifont
    ];
  };

  # List services that you want to enable:

   systemd.services.rfkill-block-all = {
     path = [ pkgs.networkmanager ];
     script = ''
       nmcli radio wifi off
     '';
     wantedBy = [ "multi-user.target" ];
   };

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  networking.firewall.enable = true;
  powerManagement.enable = true;
  services.thermald.enable = true;

  # This value determines the NixOS release from which the default settings for stateful data, like file locations and database versions on your system were taken. It‘s perfectly fine and recommended to leave this value at the release version of the first install of this system. Before changing this value read the documentation for this option (e.g. man configuration.nix or on ... ).
  system.stateVersion = "23.11"; # Did you read the comment?
}

— Me@2024-01-23 09:55:24 AM

.

.

2024.02.29 Thursday (c) All rights reserved by ACHK

3.6 Analytic continuation for gamma function, 5

A First Course in String Theory

.

Explain why the above right-hand side is well defined for \displaystyle{  \Re (z) > - N - 1  }.

~~

\displaystyle{  \begin{aligned}    \Gamma (z) &= \int_{0}^{1}t^{z-1}e^{-t}dt + \int_{1}^{\infty}t^{z-1}e^{-t}dt \\\\    \end{aligned} \\ }

.

Prove that \displaystyle{\int_{1}^{\infty}t^{z-1}e^{-t}dt} converges.

Prove that \displaystyle{\int_{0}^{1}t^{z-1}e^{-t}dt} converges.

Since both \displaystyle{e^{-t}} and \displaystyle{\sum_{n=0}^N \frac{(-t)^n}{n!}} are finite, \displaystyle{  \begin{aligned}  \sum_{n=N+1}^\infty \frac{(-t)^n}{n!} dt   \end{aligned} \\ } is also finite.

So

\displaystyle{  \begin{aligned}  &\int_{0}^{1} t^{z-1} \sum_{n=N+1}^\infty \frac{(-t)^n}{n!} dt \\  &= \sum_{n=N+1}^\infty \int_{0}^{1} t^{z-1} \frac{(-t)^n}{n!} dt \\  \end{aligned} \\ }

\displaystyle{ \begin{aligned}   &= \sum_{n=N+1}^\infty \frac{(-1)^n}{n!} \frac{1}{z+n} \left[ 1 - 0^{z+n} \right] \\ \end{aligned} \\ }

This term converges as long as \displaystyle{  \Re (z) > - N - 1   }.

So this condition is not only necessary but also sufficient for the convergence of the analytic continuation of Gamma function,

\displaystyle{  \begin{aligned}  \Gamma_c (z)   &= \sum_{n=0}^N  \frac{(-1)^n}{n!} \frac{1}{z+n} \\  &+ \int_{0}^{1} t^{z-1} \left( e^{-t} - \sum_{n=0}^N \frac{(-t)^n}{n!} dt \right) + \int_{1}^{\infty}t^{z-1}e^{-t}dt \\  \end{aligned} \\ }

— Me@2023-09-07 07:38:17 PM

.

.

2024.02.21 Wednesday (c) All rights reserved by ACHK

@dialectphilosophy, 1.6

Comments on Dialect’s Newton vs. Mach: The Bucket Experiment

1.1 In dialectphilosophy, the author claimed that acceleration is not really absolute, because measuring its value within a physical system actually requires your prior knowledge about the world and the initial calibration of the accelerometer.

While the point is correct, it is irrelevant here, because it is not what the original “acceleration is absolute” refers to.

In other words, the statement “acceleration is absolute” is with respect to Galilean transformation. It is not with respect to every kind of transformation. Confusing these two meanings is a major bug of @dialectphilosophy.

1.2 Actually, calibration is a process that lets you define what “acceleration is zero” means in terms of physical phenomenon. In other words, you decide under what condition that you should set the accelerometer reading to zero.

1.3 Note that it is always the case that you have to define the value of a physical quantity in terms of a state of the measuring device. That is exactly what “calibration” means.

1.4 More fundamentally, it is just the normal process of defining new words. We define new words either in terms of other words or in terms of physical phenomena.

2. Even though the value of acceleration, and thus also the answer to “whether the acceleration is zero”, is relative to the accelerometer calibration, the answer to “whether the acceleration is increasing, decreasing, or constant” is not.

— Me@2023-08-07 05:56:31 AM

.

.

2024.02.20 Tuesday (c) All rights reserved by ACHK

Akin’s Laws

tlb on May 4, 2018 | next [–]

Akin’s rules for spacecraft design [0] include: “Any exploration program which “just happens” to include a new launch vehicle is, de facto, a launch vehicle program.”

By analogy, any software project that includes writing a database is, de facto, a database project.

Strom on May 5, 2018 | parent | prev | next [–]

Another common version of this is: video game project turning into a video game engine project, usually not even reaching the actual content phase.

.

k__ on May 5, 2018 | root | parent | next [–]

But weren’t such projects rather common?

.

faitswulff on May 4, 2018 | parent | next [–]

The title is misleading – it’s actually about how and why they did end up writing their own db. From the article:

There’s an old adage in software engineering — “never write your own database”. So why did the OneNote team go ahead and write one as part of upgrading OneNote’s local cache implementation?

— Never Write Your Own Database (2017)

— Hacker News

.

.

2024.02.18 Sunday ACHK

宇宙的琴弦 2

這段改編自 2010 年 4 月 24 日的對話。

.

自己的世界,以自己為中心,並不是「自我中心」;

要求別人的世界,也以你自己為中心,才是「自我中心」。

.

(你又怎會知道,他人的內心優不優美呢?)

觀察她的言行舉止就可以。例如,如果她有網誌的話,你可以閱讀之,看看她通常寫什麼題材。那會反映她的一些性格特質,例如,她是否自我中心。

有很多網誌(的作者),都是自我中心的。我都不知道,閱讀來有什麼意思。

(你是指,她會講 當天做過什麼事 和 吃過什麼東西 等等?)

無錯。那些內容對讀者,完全沒有任何形式的得益。

當然,如果她寫自己的生活,寫得十分有趣,則另計;我則視之為對我有用,我仍然會有動機去欣賞。人的主要娛樂之一,就是經歷各種,不同的人生。

網誌(作者)的另一個極端,則是「完全不自我中心」。那亦不是好事,因為,那會把網誌變成,完全沒有個人魅力,沒有人性,沉悶非常,有如字典工具書。這個極端,我簡稱為「他我中心」。

「自我中心」和「他我中心」都是錯的。

— Me@2024-02-14 11:15:43 AM

.

I like to think that the important part of my blog is the content, not me. After all, users don’t care about me. It’s about what you, the reader, get out of this blog. I struggled with this for a while until I realized what I was missing. Blogs, for better or worse, are as much about the writer as they are any other topic. Personality is the essential ingredient that makes blogs so interesting, so compelling, so.. human. To avoid writing about yourself is just as much of a mistake as writing about yourself in every post. So Five Things isn’t off topic at all. It’s very much on topic. Behind every fascinating blog is a fascinating person.

— Five Things You Didn’t Know About Me (and my office)

— Coding Horror

— by Jeff Atwood

— 15 Jan 2007

.

.

2024.02.15 Thursday (c) All rights reserved by ACHK

Euler problem 19.2

How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?

isLeap :: Int -> Bool
isLeap year
  = (mod year 4 == 0
     && mod year 100 /= 0)
  || mod year 400 == 0

daysInMonth :: Int -> Int -> Int
daysInMonth year month
  | month `elem` [1, 3, 5, 7, 8, 10, 12] = 31
  | month `elem` [4, 6, 9, 11] = 30
  | month == 2 = if isLeap year
                 then 29
                 else 28

nextMonth :: Int -> Int -> Int -> Int
nextMonth dayOfWeek y m 
  = (dayOfWeek + daysInMonth y m) `mod` 7

countSundays :: Int -> Int -> Int -> Int -> Int
countSundays startYear startMonth dayOfWeek sundays
  | y > 2000  = sundays
  | m > 12    = countSundays (y+1) 1 dayOfWeek sundays
  | otherwise = countSundays y (m+1) nextDayOfWeek sun
  where
    y = startYear
    m = startMonth
    nextDayOfWeek = nextMonth dayOfWeek y m 
    sun | dayOfWeek == 0 = sundays + 1
        | otherwise      = sundays

e19 :: Int
e19 = countSundays 1901 1 2 0
-- The third argument is dayOfWeek.
-- Its value is 2 here  
-- because 1 Jan 1901 was a Tuesday. 

λ> e19
171
λ> 

— Me@2024-02-10 12:00:39 PM

.

.

2024.02.11 Sunday (c) All rights reserved by ACHK

3 Vector Fields and One-Form Fields, 2.2

Functional Differential Geometry

.

p. 21

2.4

Let

\displaystyle{  \begin{aligned}    D_b(f)(x) &= ((Df)\bigg|_x b \bigg|_x \\   \end{aligned}  },

where \displaystyle{ b(x) } is a coordinate function.

p. 12

A coordinate function \displaystyle{\chi} maps points in a coordinate patch of a manifold to a coordinate tuple:

\displaystyle{x = \chi(\mathbf{m})},

where \displaystyle{x} may have a convenient tuple structure.

2.5

\displaystyle{  \begin{aligned}    \textbf{v}(\text{f})(\textbf{m}) &\ne D_b(f)(x) \\   \end{aligned}  }

Instead, \displaystyle{ \textbf{v}(\text{f})(\textbf{m})} is a further generalization of \displaystyle{ D_b(f)(x)}.

p. 25

The vector field \displaystyle{ \textbf{v} } has a coordinate representation \displaystyle{ v}:

\displaystyle{ \begin{aligned}  \textbf{v}(\text{f})(\textbf{m})  &= D( \textbf{f} \circ \chi^{-1})(\chi(\mathbf{m})) b(\chi(\mathbf{m})) \\   &= Df(x) b(x) \\   &= v(f)(x),   \end{aligned}  }

with the definitions \displaystyle{ f = \mathbf{f} \circ \chi^{-1} } and \displaystyle{ x = \chi (\mathbf{m}) }.

So, actually,

\displaystyle{  \begin{aligned}    \textbf{v}(\text{f})(\textbf{m})   &= D_b(f)(x) \\  &= ((D(f)) \bigg|_x) b \bigg|_x \\  &= (\nabla f)\bigg|_x \cdot \vec b\bigg|_x \\  \end{aligned}  }

2.6

While \displaystyle{ x } is the tuple of coordinate components of a point, \displaystyle{ \textbf{m} } is the abstract point itself.

.

3.1

… ; they measure how quickly the coordinate functions change in the direction of the vector field, scaled by the magnitude of the vector field: …

\displaystyle{  \begin{aligned}      b^i_{\chi, \mathbf{v}} &= \mathbf{v}(\chi^i) \circ \chi^{-1} \\   \end{aligned}  }

\displaystyle{  \chi     } inputs an abstract point and outputs its coordinates.

The first factor \displaystyle{ \mathbf{v}(\chi^i) } is just the meaning of the definition of \displaystyle{ b^i_{\chi, \mathbf{v}} }. The second factor is needed because the input of \displaystyle{ b^i_{\chi, \mathbf{v}} } is \displaystyle{    x \\  }, not \displaystyle{    \mathbf{m} \\  }.

\displaystyle{  \begin{aligned}      b^i_{\chi, \mathbf{v}} (x)   &= \mathbf{v}(\chi^i) (\mathbf{m}) \\  &= \mathbf{v}(\chi^i) ( \chi^{-1} (\chi (\mathbf{m}))) \\  &= \mathbf{v}(\chi^i) \circ \chi^{-1} (x) \\   \end{aligned}  }

In other words, \displaystyle{ \mathbf{v}(\chi^i) (\mathbf{m}) \\ } is just the definition of \displaystyle{ b^i_{\chi, \mathbf{v}} (x) }.

3.2

\displaystyle{ \textbf{v}(\text{f})(\textbf{m})} is the direction derivative of the function \displaystyle{\text{f}} at the point \displaystyle{ \textbf{m} }.

Note that it is not the ordinary directional derivative.

3.2.1

Instead, the ordinary directional derivative is

\displaystyle{(Df(x)) \Delta x}

or

\displaystyle{\begin{aligned}  D_{\mathbf{v}}(f)    &= \frac{\left(\delta f\right)_{\mathbf{v}}}{|\mathbf{v}|} &= \left(\nabla f\right) \cdot \hat{\mathbf{v}} \\  \end{aligned}}

3.2.2

The generalization of directional derivative is replacing \displaystyle{\Delta x}, a vector independent of \displaystyle{x}, with \displaystyle{b(x)}, a vector function of \displaystyle{x}.

— Me@2024-02-03 04:45:17 PM

.

.

2024.02.08 Thursday (c) All rights reserved by ACHK

Posted in FDG

@dialectphilosophy, 1.5

1. Velocity is by definition relative because displacement is by definition relative.

 
\displaystyle{  \begin{aligned}  v &= \frac{s}{\Delta t} \\   s &= x_2 - x_1 \\   \end{aligned}  }
 

2. Even for either coordinate (x_1 or x_2), its value is relative because it is defined with respect to an origin chosen by you.

3.1 Furthermore, even for the origin itself, it is relative in a sense. When you choose a point as the origin of the coordinate system, you have to choose a static point. However, “whether a point is static or not” is subjective for different observers.

3.2 In other words, to be an origin, it has to be the same physical location. However, whether the physical location is the “same” could be up to debate.

— Me@2024-02-03 01:43:32 PM

.

.

2024.02.03 Saturday (c) All rights reserved by ACHK