Thought dump

Presenting my thoughts, stories and ideas to the world

13th August 2024

How to install python with conda in arch?

Installation of python-conda does not work because of issue 


```

 Imported target "pybind11::headers" includes non-existent path

```


described in  can check versions of conda here:


option is download:  can read more about ecosystem on  your .zshrc you will see


```

# >>> conda initialize >>>

# !! Contents within this block are managed by 'conda init' !!

__conda_setup="$('/home/daniel/.anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"

if [ $? -eq 0 ]; then

  eval "$__conda_setup"

else

  if [ -f "/home/daniel/.anaconda3/etc/profile.d/conda.sh" ]; then

    . "/home/daniel/.anaconda3/etc/profile.d/conda.sh"

  else

    export PATH="/home/daniel/.anaconda3/bin:$PATH"

  fi

fi

unset __conda_setup

# <<< conda initialize <<<

```


It is recommended to avoid base env as default


```

conda config --set auto_activate_base false

```


## Activation new env


Lets assume, we will work on project called `ir`. We will create env by:


```

conda create --name ir

```


and activate it by


```

conda activate ir

```


To install packages:


```

conda install --file requirements.txt

```

13th August 2024

How to setup mongo in repl set mode for prisma on arch linux?

Install bin version, mongo from source will compile even few hours


```

yay -S mongodb-bin

```


start / enable `mongodb.service`


```

sudo systemctl enable mongodb.service

sudo systemctl start mongodb.service

```

optionally check status

```

sudo systemctl status mongodb.service

```

connect to mongo

```
mongosh
```


By default replicaset is disabled. You can confirm it in `mongosh`

```

rs.status()

MongoServerError[NoReplicationEnabled]: not running with --replSet
```

Now time to change settings:

```

sudo nvim /etc/mongodb.conf

```


replace

```
#replcation:
```

by

```

replication:

  replSetName: "rs0"


```


restart mongo service


```

sudo systemctl restart mongodb.service

```


now you can see different error


```

rs.status()

MongoServerError[NotYetInitialized]: no replset config has been received

```


so lets init replicaset


```

rs.initiate()

{

  info2: 'no configuration specified. Using a default configuration for the set',

  me: '127.0.0.1:27017',

  ok: 1

}

```


Finally rs.status() works correctly.

13th August 2024

How to setup redis on arch linux!

Install


```

yay -S redis

```


Enable / Start 


```

sudo systemctl enable redis.service

sudo systemctl start redis.service

```


optionally check status


```

sudo systemctl status redis.service

```


start cli and check if redis server respond to ping


```

redis-cli

127.0.0.1:6379> ping

PONG

```

12th August 2024

How to configure display manager with console UI: ly?

Repo:  -S ly

```


Enabling service


```

systemctl enable ly.service

```


How to add cmatrix animation during login?


In file: /etc/ly/config.ini set


```

animation = matrix

```


And install cmatrix:


```

yay -S cmatrix

```



12th August 2024

How to add support of voice on qemu by command line?

To command that start your machine add:


```

-audiodev pa,id=snd0 -device ich9-intel-hda -device hda-output,audiodev=snd0

```


for example your full command can look like this:


```

qemu-system-x86_64 -enable-kvm --boot order=d -drive file=/home/daniel/qemu/Statscore.img -m 40G --smp cores=8 --cpu host --vga virtio -display sdl,gl=on -audiodev pa,id=snd0 -device ich9-intel-hda -device hda-output,audiodev=snd0

```

12th August 2024

How to setup quemu vm with quickemu?

Install quickemu


```

yay -Sy quickemu

```


Get new ubuntu image


```

quickget ubuntu 22.04

```


By default quickemu works in uefi mode, you can change it typing 


```

boot="legacy"

```


at the ond of ubuntu-22.04.conf file. 


You can start your vm by command:


```

quickemu --vm ubuntu-22.04.conf

``` 



10th August 2024

How to expose your local sever to world wide web?

By default you cannot connect directly from global network to you computer in local home network. To configure it you have to change router settings or setup tunnel. In this article we will show tunnel.


Install ngrok


```

yay -S ngrok

```


Login to ngrok page and get token


```

will see command like this


```

ngrok config add-authtoken xxx

```


now expose http on port


```

ngrok http

10th August 2024

How to make a screen shot in i3?

Install flameshot


```

yay -S flameshot

```


open i3 config 


```

nvim ~/.config/i3/config

```


add line


```

bindsym Print exec "flameshot gui"

```


reload i3


```

super + shift + r

```


use your PrtSc button on keyboard

10th August 2024

How to manage zsh plugins with antigen!

Install antigen


```

curl -L git.io/antigen > ~/.local/share/antigen.zsh

```


now paste to `~/.zshrc` content


```

# antigen path when using Homebrew:

source ~/.local/share/antigen.zsh

# if you installed antigen using curl:

# source /path-to-antigen/antigen.zsh

# Load the oh-my-zsh's library.

antigen use oh-my-zsh

# load plugins

antigen bundle git

antigen bundle node

antigen bundle npm

antigen bundle zsh-users/zsh-autosuggestions

antigen bundle zdharma-continuum/fast-syntax-highlighting

antigen bundle djui/alias-tips

antigen theme robbyrussell

# Tell Antigen that you're done

antigen apply

# more configuration

```


Lets install package adding auto-recognizing of node vesion by .nvmrc and applying it by nvm.


You have to install nvm. It was described in  you can add


```

antigen bundle Sparragus/zsh-auto-nvm-use

```


but

```

# nvm

export NVM_DIR="$HOME/.nvm"

[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

```


have to be pasted ealier. My file looks following


```

# antigen path when using Homebrew:

source ~/.local/share/antigen.zsh

# if you installed antigen using curl:

# source /path-to-antigen/antigen.zsh

# Load the oh-my-zsh's library.

antigen use oh-my-zsh

# nvm

export NVM_DIR="$HOME/.nvm"

[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

# load plugins

antigen bundle git

antigen bundle node

antigen bundle npm

antigen bundle zsh-users/zsh-autosuggestions

antigen bundle zdharma-continuum/fast-syntax-highlighting

antigen bundle djui/alias-tips

antigen bundle Sparragus/zsh-auto-nvm-use

antigen theme robbyrussell

# Tell Antigen that you're done

antigen apply

# more configuration

```


now you cat see that node version is changed if .nvmrc file exist in current directory.



9th August 2024

How to measure max ram usage of process!

Install time


```

yay -S time

```


use it with -v (verbose option). For example


```

/usr/bin/time -v pnpm build

```


result can be following


```

 Command being timed: "pnpm build"

User time (seconds): 23.70

System time (seconds): 1.27

Percent of CPU this job got: 163%

Elapsed (wall clock) time (h:mm:ss or m:ss): 0:15.25

Average shared text size (kbytes): 0

Average unshared data size (kbytes): 0

Average stack size (kbytes): 0

Average total size (kbytes): 0

Maximum resident set size (kbytes): 2959112

Average resident set size (kbytes): 0

Major (requiring I/O) page faults: 0

Minor (reclaiming a frame) page faults: 704182

Voluntary context switches: 17418

Involuntary context switches: 531

Swaps: 0

File system inputs: 0

File system outputs: 1104

Socket messages sent: 0

Socket messages received: 0

Signals delivered: 0

Page size (bytes): 4096

Exit status: 0

```


Find `Maximum resident set size`. In our case


```

 Maximum resident set size (kbytes): 2959112

```


what can be read as 2.959 gigabytes