Skip to content

Latest commit

 

History

History
154 lines (117 loc) · 6.13 KB

.dementia.org

File metadata and controls

154 lines (117 loc) · 6.13 KB

dementia.org

Little reminders

To merge multiple tracks with ffmpeg: ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -i INPUTN -filter_complex amix=inputs=N:duration=longest OUTPUT

Camera utilities: guvcview, xawtv

To find out what package a given file belongs to: pacman -Qo FILEPATH

Emacs lisp eval s-exp with pp-eval-expression.

Org element parse document: M-x pp-eval-expression RET (org-element-parse-buffer).

Tutorials

Camera configuration on linux

To configure the camera I used guvcview (for viewing/testing parameters), v4l2-ctl (Video4Linux) to set values through a command and udev for persistance. To find out the right video settings (brightness, contrast, exposure, etc.) we tweak them in guvcview (Image Controls) and copy them into the command.

To get current resolution/format info, we use -V (uppercase, lowercase is for setting). To set the camera’s resolution to 640x480, we use -v = =width=640,height=480.

v4l2-ctl command:

# This command contains `$devnode', so it's not for use in the console. delete
# `-d $devnode' to run (test) the command on the command line.

/usr/bin/v4l2-ctl -d $devnode -c brightness=14 -c contrast=28 -c saturation=80 \
                  -c hue=0 -c white_balance_automatic=1 -c gamma=101 -c gain=0 \
                  -c power_line_frequency=1 -c sharpness=3 \
                  -c backlight_compensation=1 -c auto_exposure=1 \
                  -c exposure_time_absolute=128 \
                  -c exposure_dynamic_framerate=1 \
                  -v width=640,height=480

To make these settings persist, we follow this. To get the device vendor id and product id (these don’t ever, ever change) we use lsusb.

udev config:

# /etc/udev/rules.d/99-webcam.rules

KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", \
      ATTR{index}=="0", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="6366", \
      RUN+="<insert v4l2-ctl command here>"

Wordpress

  1. Install Apache, php, mariadb
  2. Configure Apache: /etc/httpd/conf/extra/httpd-wordpress.conf and /etc/httpd/conf/httpd.conf (Include conf/extra/…)
  3. Uncomment LoadModule rewrite_module modules/mod_rewrite.so ?
  4. Add DirectoryIndex index.php into IfModule dir_module entry.

Mariadb setup

root$ mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

2 users by default: root and mysql. Both without a password but you have to be root and mysql user respectively to connect.

If mariadb is already installed, # rm -rf /var/lib/mysql.

Create a user and database.

MariaDB> CREATE DATABASE wordpress;
MariaDB> GRANT ALL PRIVILEGES ON wordpress.* TO "wp-user"@"localhost" IDENTIFIED BY "choose_db_password";
MariaDB> FLUSH PRIVILEGES;
MariaDB> EXIT

PHP setup

This is the setup of PHP to work with Apache. https://wiki.archlinux.org/title/Apache_HTTP_Server

  1. Install php-apache.
  2. Comment this line in /etc/httpd/conf/httpd.conf: #LoadModule mpm_event_module modules/mod_mpm_event.so
  3. Uncomment this line in the file above: LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
  4. Place this at the end of the LoadModule list: LoadModule php_module modules/libphp.so, AddHandler php-script .php
  5. Insert PHPIniDir "/etc/php" into php_module.conf, inside <IfModule php_module> tag.
  6. Place this at the end of the Include list: Include conf/extra/php_module.conf

In order for PHP to work with MySql, add (or uncomment) these lines to /etc/php/php.ini:

Retart httpd.service and mariadb.service

Wp setup steps

I don’t know if these change anything, but I get a stupid error so I did:

  1. Rename php-config-sample.php into php-config.php
  2. Edit php-config.php, change db name to wordpress, change user name to wp-user, change password to choose_db_password.

Migrate pass to another device

Put .password-store/ into the other device’s user directory.

Put the contents of .gnupg/ (or .config/gnupg/) into .gnupg/ (or config/gnupg/). If you use the .config/... variant, make sure XDG_CONFIG_DIR is set, or it will not find the secret keys. The contents of .password-store you can share anywhere. The contents of .gnupg/ should never be shared, whatever the circumstance, because you’ll give away access to your passwords.

Postgresql

First, install postgres (pacman -S postgresql postgresql-old-upgrade).

Init postgres

[postgres]$ initdb -D /var/lib/postgres/data

/var/lib/postgres/data can be any directory, but the owner must be the postgres user. TODO: more postgres user details?

Create first user

[postgres]$ createuser --interactive
[postgres]$ createdb <username>

Give owner privileges to user

[postgres]$ psql
psql (16.1)
Type "help" for help.

postgres=# ALTER DATABASE <username> OWNER TO <username>;
ALTER DATABASE
postgres=# exit

Configure local users’ privileges

In pg_hba.conf, write these lines:

# ..................

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# "local" is for Unix domain socket connections only
local   samerole        all                                     trust

# ..................

This will ensure that when you connect with your db user, you will automatically get connected to that user’s db correspondingly. For example with psql -U <username> you will instantly get access to the same db. Happy development.

Migrate to a new version

Concatenate 2 pdf files

pdftk file1.pdf file2.pdf cat output outputfile.pdf