From 6cc9d8c72a56563b6d1a12b8b441dfa9dde345e9 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 28 Apr 2020 17:29:52 +0200 Subject: Long overdue first commit with content --- content/en/blog/miscellaneous/_index.md | 5 + content/en/blog/miscellaneous/bacula-bareos.md | 38 +++++++ content/en/blog/miscellaneous/bash-tcp-client.md | 15 +++ .../en/blog/miscellaneous/boot-from-initramfs.md | 16 +++ content/en/blog/miscellaneous/building-rpms.md | 29 +++++ .../blog/miscellaneous/clean-old-centos-kernels.md | 11 ++ .../miscellaneous/debug-disk-usage-postgresql.md | 14 +++ content/en/blog/miscellaneous/etc-update-alpine.md | 38 +++++++ content/en/blog/miscellaneous/fstab.md | 9 ++ content/en/blog/miscellaneous/i3dropdown.md | 32 ++++++ content/en/blog/miscellaneous/libreoffice.md | 9 ++ .../en/blog/miscellaneous/link-deleted-inode.md | 10 ++ content/en/blog/miscellaneous/make.md | 10 ++ content/en/blog/miscellaneous/mencoder.md | 21 ++++ content/en/blog/miscellaneous/mssql-centos-7.md | 29 +++++ .../my-postgresql-role-cannot-login.md | 12 +++ content/en/blog/miscellaneous/nginx-ldap.md | 25 +++++ content/en/blog/miscellaneous/pleroma.md | 117 +++++++++++++++++++++ .../en/blog/miscellaneous/postgresql-read-only.md | 17 +++ .../en/blog/miscellaneous/postgresql-reassign.md | 18 ++++ content/en/blog/miscellaneous/pulseaudio.md | 11 ++ .../purge-postfix-queue-based-content.md | 13 +++ content/en/blog/miscellaneous/qmail.md | 21 ++++ content/en/blog/miscellaneous/rocketchat.md | 18 ++++ .../miscellaneous/screen-cannot-open-terminal.md | 17 +++ content/en/blog/miscellaneous/seti-at-home.md | 18 ++++ .../en/blog/miscellaneous/sqlite-pretty-print.md | 16 +++ content/en/blog/miscellaneous/switching-to-hugo.md | 7 ++ 28 files changed, 596 insertions(+) create mode 100644 content/en/blog/miscellaneous/_index.md create mode 100755 content/en/blog/miscellaneous/bacula-bareos.md create mode 100755 content/en/blog/miscellaneous/bash-tcp-client.md create mode 100644 content/en/blog/miscellaneous/boot-from-initramfs.md create mode 100644 content/en/blog/miscellaneous/building-rpms.md create mode 100644 content/en/blog/miscellaneous/clean-old-centos-kernels.md create mode 100644 content/en/blog/miscellaneous/debug-disk-usage-postgresql.md create mode 100644 content/en/blog/miscellaneous/etc-update-alpine.md create mode 100644 content/en/blog/miscellaneous/fstab.md create mode 100644 content/en/blog/miscellaneous/i3dropdown.md create mode 100644 content/en/blog/miscellaneous/libreoffice.md create mode 100644 content/en/blog/miscellaneous/link-deleted-inode.md create mode 100644 content/en/blog/miscellaneous/make.md create mode 100644 content/en/blog/miscellaneous/mencoder.md create mode 100644 content/en/blog/miscellaneous/mssql-centos-7.md create mode 100644 content/en/blog/miscellaneous/my-postgresql-role-cannot-login.md create mode 100644 content/en/blog/miscellaneous/nginx-ldap.md create mode 100644 content/en/blog/miscellaneous/pleroma.md create mode 100644 content/en/blog/miscellaneous/postgresql-read-only.md create mode 100644 content/en/blog/miscellaneous/postgresql-reassign.md create mode 100644 content/en/blog/miscellaneous/pulseaudio.md create mode 100644 content/en/blog/miscellaneous/purge-postfix-queue-based-content.md create mode 100644 content/en/blog/miscellaneous/qmail.md create mode 100644 content/en/blog/miscellaneous/rocketchat.md create mode 100644 content/en/blog/miscellaneous/screen-cannot-open-terminal.md create mode 100644 content/en/blog/miscellaneous/seti-at-home.md create mode 100644 content/en/blog/miscellaneous/sqlite-pretty-print.md create mode 100755 content/en/blog/miscellaneous/switching-to-hugo.md (limited to 'content/en/blog/miscellaneous') diff --git a/content/en/blog/miscellaneous/_index.md b/content/en/blog/miscellaneous/_index.md new file mode 100644 index 0000000..806622d --- /dev/null +++ b/content/en/blog/miscellaneous/_index.md @@ -0,0 +1,5 @@ +--- +title: "Miscellaneous" +linkTitle: "Miscellaneous" +weight: 40 +--- diff --git a/content/en/blog/miscellaneous/bacula-bareos.md b/content/en/blog/miscellaneous/bacula-bareos.md new file mode 100755 index 0000000..a5fd0be --- /dev/null +++ b/content/en/blog/miscellaneous/bacula-bareos.md @@ -0,0 +1,38 @@ +--- +title: "Some bacula/bareos commands" +linkTitle: "Some bacula/bareos commands" +date: 2018-01-10 +description: > + Some bacula/bareos commands +--- + +Bacula is a backup software, bareos is a fork of it. Here are some tips and solutions to specific problems. + +## Adjust an existing volume for pool configuration changes + +In bconsole, run the following commands and follow the prompts : +{{< highlight sh >}} +update pool from resource +update all volumes in pool +{{< /highlight >}} + +## Using bextract + +On the sd you need to have a valid device name with the path to your tape, then run : +{{< highlight sh >}} +bextract -V + +{{< /highlight >}} + +## Integer out of range sql error + +If you get an sql error `integer out of range` for an insert query in the catalog, check the id sequence for the table which had the error. For +example with the basefiles table : +{{< highlight sql >}} +select nextval('basefiles_baseid_seq'); +{{< /highlight >}} + +You can then fix it with : +{{< highlight sql >}} +alter table BaseFiles alter column baseid set data type bigint; +{{< /highlight >}} diff --git a/content/en/blog/miscellaneous/bash-tcp-client.md b/content/en/blog/miscellaneous/bash-tcp-client.md new file mode 100755 index 0000000..f10f22b --- /dev/null +++ b/content/en/blog/miscellaneous/bash-tcp-client.md @@ -0,0 +1,15 @@ +--- +title: "Bash tcp client" +linkTitle: "Bash tcp client" +date: 2018-03-21 +description: > + Bash tcp client +--- + +There are somea fun toys in bash. I would not rely on it for a production script, but here is one such things : + +{{< highlight sh >}} +exec 5<>/dev/tcp/10.1.0.254/8080 +bash$ echo -e "GET / HTTP/1.0\n" >&5 +bash$ cat <&5 +{{< /highlight >}} diff --git a/content/en/blog/miscellaneous/boot-from-initramfs.md b/content/en/blog/miscellaneous/boot-from-initramfs.md new file mode 100644 index 0000000..3d5c55e --- /dev/null +++ b/content/en/blog/miscellaneous/boot-from-initramfs.md @@ -0,0 +1,16 @@ +--- +title: "Boot from initramfs shell" +linkTitle: "Boot from initramfs shell" +date: 2014-01-24 +description: > + Boot from initramfs shell +--- + +I had to finish booting from an initramfs shell, here is how I used `switch_root` to do so : + +{{< highlight sh >}} +lvm vgscan +lvm vgchange -ay vg +mount -t ext4 /dev/mapper/vg-root /root +exec switch_root -c /dev/console /root /sbin/init +{{< /highlight >}} diff --git a/content/en/blog/miscellaneous/building-rpms.md b/content/en/blog/miscellaneous/building-rpms.md new file mode 100644 index 0000000..99667eb --- /dev/null +++ b/content/en/blog/miscellaneous/building-rpms.md @@ -0,0 +1,29 @@ +--- +title: "Building rpm packages" +linkTitle: "Building rpm packages" +date: 2016-02-22 +description: > + Building rpm packages +--- + +Here is how to build locally an rpm package. Tested at the time on a centos 7. + +## Setup your environment + +First of all, you have to use a non-root account. + + - Create the necessary directories : `mkdir -p ~/rpmbuild/{BUILD,RPMS,S{OURCE,PEC,RPM}S}` + - Tell rpmbuild where to build by adding the following in your `.rpmmacros` file : `echo -e “%_topdir\t$HOME/rpmbuild” » ~/.rpmmacros` + +## Building package + +There are several ways to build a rpm, depending on what kind of stuff you have to deal with. + +### Building from a tar.gz archive containing a .spec file + +Run the following on you .tar.gz archive : `rpmbuild -tb memcached-1.4.0.tar.gz`. When the building process ends, you will find your package in a `$HOME/rpmbuild/RPMS/x86_64/` like directory, depending on your architecture. + +### Building from a spec file + + - `rpmbuild -v -bb ./contrib/redhat/collectd.spec` + - If you are missing some dependencies : `rpmbuild -v -bb ./contrib/redhat/collectd.spec 2>&1 |awk '/is needed/ {print $1;}'|xargs yum install -y` diff --git a/content/en/blog/miscellaneous/clean-old-centos-kernels.md b/content/en/blog/miscellaneous/clean-old-centos-kernels.md new file mode 100644 index 0000000..eb49269 --- /dev/null +++ b/content/en/blog/miscellaneous/clean-old-centos-kernels.md @@ -0,0 +1,11 @@ +--- +title: "Clean old centos kernels" +linkTitle: "Clean old centos kernels" +date: 2016-02-03 +description: > + Clean old centos kernels +--- + +There is a setting in `/etc/yum.conf` that does exactly that : `installonly_limit=`. The value of this setting is the number of older kernels that are kept when a new kernel is installed by yum. If the number of installed kernels becomes greater than this, the oldest one gets removed at the same time a new one is installed. + +This cleaning can also be done manually with a command that belongs to the yum-utils package : `package-cleanup –oldkernels –count=2` diff --git a/content/en/blog/miscellaneous/debug-disk-usage-postgresql.md b/content/en/blog/miscellaneous/debug-disk-usage-postgresql.md new file mode 100644 index 0000000..827d69f --- /dev/null +++ b/content/en/blog/miscellaneous/debug-disk-usage-postgresql.md @@ -0,0 +1,14 @@ +--- +title: "Investigate postgresql disk usage" +linkTitle: "Investigate postgresql disk usage" +date: 2015-11-24 +description: > + Investigate postgresql disk usage +--- + +## How to debug disk occupation in postgresql + +- get a database oid number from `ncdu` in `/var/lib/postgresql` +- reconcile oid number and db name with : `select oid,datname from pg_database where oid=18595;` +- Then in database : `select table_name,pg_relation_size(quote_ident(table_name)) from information_schema.tables where table_schema = 'public' order by 2;` + diff --git a/content/en/blog/miscellaneous/etc-update-alpine.md b/content/en/blog/miscellaneous/etc-update-alpine.md new file mode 100644 index 0000000..dbc0824 --- /dev/null +++ b/content/en/blog/miscellaneous/etc-update-alpine.md @@ -0,0 +1,38 @@ +--- +title: "etc-update script for alpine linux" +linkTitle: "etc-update script for alpine linux" +date: 2019-04-02 +description: > + etc-update script for alpine linux +--- + +Alpine linux doesn't seem to have a tool to merge pending configuration changes, so I wrote one : +{{< highlight sh >}} +#!/bin/sh +set -eu + +for new_file in $(find /etc -iname '*.apk-new'); do + current_file=${new_file%.apk-new} + echo "===== New config file version for $current_file =====" + diff ${current_file} ${new_file} || true + while true; do + echo "===== (r)eplace file with update? (d)iscard update? (m)erge files? (i)gnore =====" + PS2="k/d/m/i? " + read choice + case ${choice} in + r) + mv ${new_file} ${current_file} + break;; + d) + rm -f ${new_file} + break;; + m) + vimdiff ${new_file} ${current_file} + break;; + i) + break;; + esac + done +done +{{< /highlight >}} + diff --git a/content/en/blog/miscellaneous/fstab.md b/content/en/blog/miscellaneous/fstab.md new file mode 100644 index 0000000..3b7cded --- /dev/null +++ b/content/en/blog/miscellaneous/fstab.md @@ -0,0 +1,9 @@ +--- +title: "Use spaces in fstab" +linkTitle: "Use spaces in fstab" +date: 2011-09-29 +description: > + How to use spaces in a folder name in fstab +--- + +Here is how to use spaces in a folder name in fstab : you put `\040` where you want a space. diff --git a/content/en/blog/miscellaneous/i3dropdown.md b/content/en/blog/miscellaneous/i3dropdown.md new file mode 100644 index 0000000..52262ec --- /dev/null +++ b/content/en/blog/miscellaneous/i3dropdown.md @@ -0,0 +1,32 @@ +--- +title: "i3dropdown" +linkTitle: "i3dropdown" +date: 2020-01-23 +description: > + i3dropdown +--- + +i3dropdown is a tool to make any X application drop down from the top of the screen, in the famous quake console style back in the day. + +## Compilation + +First of all, you have get i3dropdown and compile it. It does not have any dependencies so it is really easy : +{{< highlight sh >}} +git clone https://gitlab.com/exrok/i3dropdown +cd i3dropdown +make +cp build/i3dropdown ~/bin/ +{{< /highlight >}} + +## i3 configuration + +Here is a working example of the pavucontrol app, a volume mixer I use : +{{< highlight conf >}} +exec --no-startup-id i3 --get-socketpath > /tmp/i3wm-socket-path +for_window [instance="^pavucontrol"] floating enable +bindsym Mod4+shift+p exec /home/julien/bin/i3dropdown -W 90 -H 50 pavucontrol pavucontrol-qt +{{< /highlight >}} + +To work properly, i3dropdown needs to have the path to the i3 socket. Because the command to get the socketpath from i3 is a little slow, it is best to cache it somewhere. By default +i3dropdown recognises `/tmp/i3wm-socket-path`. Then each window managed by i3dropdown needs to be floating. The last line bind a key to invoke or mask the app. + diff --git a/content/en/blog/miscellaneous/libreoffice.md b/content/en/blog/miscellaneous/libreoffice.md new file mode 100644 index 0000000..29b8541 --- /dev/null +++ b/content/en/blog/miscellaneous/libreoffice.md @@ -0,0 +1,9 @@ +--- +title: "Removing libreoffice write protection" +linkTitle: "Removing libreoffice write protection" +date: 2018-03-05 +description: > + Removing libreoffice write protection +--- + +You can choose to ignore write-protection by setting `Tools > Options > libreOffice Writer > Formatting Aids > Protected Areas > Ignore protection`. diff --git a/content/en/blog/miscellaneous/link-deleted-inode.md b/content/en/blog/miscellaneous/link-deleted-inode.md new file mode 100644 index 0000000..3542cd2 --- /dev/null +++ b/content/en/blog/miscellaneous/link-deleted-inode.md @@ -0,0 +1,10 @@ +--- +title: "Link to a deleted inode" +linkTitle: "Link to a deleted inode" +date: 2018-03-05 +description: > + Link to a deleted inode +--- + +Get the inode number from `lsof`, then run `debugfs -w /dev/mapper/vg-home -R 'link <16008> /some/path'` where 16008 is the inode number (the < > are important, they tell debugfs you manipulate an inode). + diff --git a/content/en/blog/miscellaneous/make.md b/content/en/blog/miscellaneous/make.md new file mode 100644 index 0000000..0795127 --- /dev/null +++ b/content/en/blog/miscellaneous/make.md @@ -0,0 +1,10 @@ +--- +title: "Understanding make" +linkTitle: "Understanding make" +date: 2018-01-30 +description: > + Understanding make +--- + +http://gromnitsky.users.sourceforge.net/articles/notes-for-new-make-users/ + diff --git a/content/en/blog/miscellaneous/mencoder.md b/content/en/blog/miscellaneous/mencoder.md new file mode 100644 index 0000000..4bb8fd0 --- /dev/null +++ b/content/en/blog/miscellaneous/mencoder.md @@ -0,0 +1,21 @@ +--- +title: "Aggregate images into a video with mencoder" +linkTitle: "Aggregate images into a video with mencoder" +date: 2018-04-30 +description: > + Aggregate images into a video withmencoder +--- + +## Aggregate png images into a video +{{< highlight sh >}} +mencoder mf://*.png -mf w=1400:h=700:fps=1:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o output.avi +{{< /highlight >}} + +You should use the following to specify a list of files instead of `*.png`: +{{< highlight sh >}} +mf://@list.txt +{{< /highlight >}} + +## References + +- http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-enc-images.html diff --git a/content/en/blog/miscellaneous/mssql-centos-7.md b/content/en/blog/miscellaneous/mssql-centos-7.md new file mode 100644 index 0000000..019f442 --- /dev/null +++ b/content/en/blog/miscellaneous/mssql-centos-7.md @@ -0,0 +1,29 @@ +--- +title: "Installing mssql on centos 7" +linkTitle: "Installing mssql on centos 7" +date: 2019-07-09 +description: > + Installing mssql on centos 7 +--- + +{{< highlight sh >}} +vi /etc/sysconfig/network-scripts/ifcfg-eth0 +vi /etc/resolv.conf +curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo +curl -o /etc/yum.repos.d/mssql-prod.repo https://packages.microsoft.com/config/rhel/7/prod.repo +yum update +yum install -y mssql-server mssql-tools +yum install -y sudo +localectl set-locale LANG=en_US.utf8 +echo "export LANG=en_US.UTF-8" >> /etc/profile.d/locale.sh +echo "export LANGUAGE=en_US.UTF-8" >> /etc/profile.d/locale.sh +yum install -y openssh-server +systemctl enable sshd +systemctl start sshd +passwd +/opt/mssql/bin/mssql-conf setup +rm -f /etc/localtime +ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime +/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -p +{{< /highlight >}} + diff --git a/content/en/blog/miscellaneous/my-postgresql-role-cannot-login.md b/content/en/blog/miscellaneous/my-postgresql-role-cannot-login.md new file mode 100644 index 0000000..2b958bf --- /dev/null +++ b/content/en/blog/miscellaneous/my-postgresql-role-cannot-login.md @@ -0,0 +1,12 @@ +--- +title: "Cannot login role into postgresql" +linkTitle: "Cannot login role into postgresql" +date: 2015-11-24 +description: > + Cannot login role into postgresql +--- + +{{< highlight sh >}} +ALTER ROLE "user" LOGIN; +{{< /highlight >}} + diff --git a/content/en/blog/miscellaneous/nginx-ldap.md b/content/en/blog/miscellaneous/nginx-ldap.md new file mode 100644 index 0000000..b480943 --- /dev/null +++ b/content/en/blog/miscellaneous/nginx-ldap.md @@ -0,0 +1,25 @@ +--- +title: "LDAP auth with nginx" +linkTitle: "LDAP auth with nginx" +date: 2018-03-05 +description: > + LDAP auth with nginx +--- + +{{< highlight sh >}} +ldap_server ldap { + auth_ldap_cache_enabled on; + auth_ldap_cache_expiration_time 10000; + auth_ldap_cache_size 1000; + + url "ldaps://ldapslave.adyxax.org/ou=Users,dc=adyxax,dc=org?uid?sub?(objectClass=posixAccount)"; + binddn "cn=admin,dc=adyxax,dc=org"; + binddn_passwd secret; + group_attribute memberUid; + group_attribute_is_dn off; + satisfy any; + require valid_user; + #require group "cn=admins,ou=groups,dc=adyxax,dc=org"; +} +{{< /highlight >}} + diff --git a/content/en/blog/miscellaneous/pleroma.md b/content/en/blog/miscellaneous/pleroma.md new file mode 100644 index 0000000..91c10f8 --- /dev/null +++ b/content/en/blog/miscellaneous/pleroma.md @@ -0,0 +1,117 @@ +--- +title: "Pleroma installation notes" +linkTitle: "Pleroma installation notes" +date: 2018-11-16 +description: > + Pleroma installation notes +--- + +This article is about my installation of pleroma in a standard alpine linux lxd container. + +## Installation notes +{{< highlight sh >}} +apk add elixir nginx postgresql postgresql-contrib git sudo erlang-ssl erlang-xmerl erlang-parsetools erlang-runtime-tools make gcc build-base vim vimdiff htop curl +/etc/init.d/postgresql start +rc-update add postgresql default +cd /srv +git clone https://git.pleroma.social/pleroma/pleroma +cd pleroma/ +mix deps.get +mix generate_config +cp config/generated_config.exs config/prod.secret.exs +cat config/setup_db.psql +{{< /highlight >}} + +At this stage you are supposed to execute these setup_db commands in your postgres. Instead of chmoding and stuff detailed in the official documentation I execute it manually from psql shell : +{{< highlight sh >}} +su - postgres +psql +CREATE USER pleroma WITH ENCRYPTED PASSWORD 'XXXXXXXXXXXXXXXXXXX'; +CREATE DATABASE pleroma_dev OWNER pleroma; +\c pleroma_dev; +CREATE EXTENSION IF NOT EXISTS citext; +CREATE EXTENSION IF NOT EXISTS pg_trgm; +{{< /highlight >}} + +Now back to pleroma : +{{< highlight sh >}} +MIX_ENV=prod mix ecto.migrate +MIX_ENV=prod mix phx.server +{{< /highlight >}} + +If this last command runs without error your pleroma will be available and you can test it with : +{{< highlight sh >}} +curl http://localhost:4000/api/v1/instance +{{< /highlight >}} + +If this works, you can shut it down with two C-c and we can configure nginx. This article doesn't really cover my setup since my nginx doesn't run there, and I am using letsencrypt wildcard certificates fetched somewhere else unrelated, so to simplify I only paste the vhost part of the configuration : +{{< highlight sh >}} +### in nginx.conf inside the container ### +# {{{ pleroma +proxy_cache_path /tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cache:10m max_size=500m inactive=200m use_temp_path=off; +ssl_session_cache shared:ssl_session_cache:10m; +server { + listen 80; + listen [::]:80; + server_name social.adyxax.org; + return 301 https://$server_name$request_uri; +} +server { + listen 443 ssl; + listen [::]:443 ssl; + server_name social.adyxax.org; + root /usr/share/nginx/html; + + include /etc/nginx/vhost.d/social.conf; + ssl_certificate /etc/nginx/fullchain; + ssl_certificate_key /etc/nginx/privkey; +} +# }}} + +### in a vhost.d/social.conf ### +location / { + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://172.16.1.8:4000/; + + add_header 'Access-Control-Allow-Origin' '*'; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + allow all; +} + +location /proxy { + proxy_cache pleroma_media_cache; + proxy_cache_lock on; + proxy_pass http://172.16.1.8:4000$request_uri; +} + +client_max_body_size 20M; +{{< /highlight >}} + +Now add the phx.server on boot. I run pleroma has plemora user to completely limit the permissions of the server software. The official documentation has all files belong to the user running the server, I prefer that only the uploads directory does. Since I don't run nginx from this container I also edit this out : +{{< highlight sh >}} +adduser -s /sbin/nologin -D -h /srv/pleroma pleroma +cp -a /root/.hex/ /srv/pleroma/. +cp -a /root/.mix /srv/pleroma/. +chown -R pleroma:pleroma /srv/pleroma/uploads +cp installation/init.d/pleroma /etc/init.d +sed -i /etc/init.d/pleroma -e '/^directory=/s/=.*/=\/srv\/pleroma/' +sed -i /etc/init.d/pleroma -e '/^command_user=/s/=.*/=nobody:nobody/' +sed -i /etc/init.d/pleroma -e 's/nginx //' +rc-update add pleroma default +rc-update add pleroma start +{{< /highlight >}} + +You should be good to go and access your instance from any web browser. After creating your account in a web browser come back to the cli and set yourself as moderator : +{{< highlight sh >}} +mix set_moderator adyxax +{{< /highlight >}} + +## References + +- https://git.pleroma.social/pleroma/pleroma diff --git a/content/en/blog/miscellaneous/postgresql-read-only.md b/content/en/blog/miscellaneous/postgresql-read-only.md new file mode 100644 index 0000000..c064e97 --- /dev/null +++ b/content/en/blog/miscellaneous/postgresql-read-only.md @@ -0,0 +1,17 @@ +--- +title: "Grant postgresql read only access" +linkTitle: "Grant postgresql read only access" +date: 2015-11-24 +description: > + Grant postgresql read only access +--- + +{{< highlight sh >}} +GRANT CONNECT ON DATABASE "db" TO "user"; +\c db +GRANT USAGE ON SCHEMA public TO "user"; +GRANT SELECT ON ALL TABLES IN SCHEMA public TO "user"; +ALTER DEFAULT PRIVILEGES IN SCHEMA public + GRANT SELECT ON TABLES TO "user"; +{{< /highlight >}} + diff --git a/content/en/blog/miscellaneous/postgresql-reassign.md b/content/en/blog/miscellaneous/postgresql-reassign.md new file mode 100644 index 0000000..7779c40 --- /dev/null +++ b/content/en/blog/miscellaneous/postgresql-reassign.md @@ -0,0 +1,18 @@ +--- +title: "Change owner on a postgresql database and all tables" +linkTitle: "Change owner on a postgresql database and all tables" +date: 2012-04-20 +description: > + Change owner on a postgresql database and all tables +--- + +{{< highlight sh >}} +ALTER DATABASE name OWNER TO new_owner +for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" YOUR_DB` ; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done +for tbl in `psql -qAt -c "select sequence_name from information_schema.sequences where sequence_schema = 'public';" YOUR_DB` ; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done +for tbl in `psql -qAt -c "select table_name from information_schema.views where table_schema = 'public';" YOUR_DB` ; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done +{{< /highlight >}} + +{{< highlight sh >}} +reassign owned by "support" to "test-support"; +{{< /highlight >}} diff --git a/content/en/blog/miscellaneous/pulseaudio.md b/content/en/blog/miscellaneous/pulseaudio.md new file mode 100644 index 0000000..c656275 --- /dev/null +++ b/content/en/blog/miscellaneous/pulseaudio.md @@ -0,0 +1,11 @@ +--- +title: "Pulseaudio" +linkTitle: "Pulseaudio" +date: 2018-09-25 +description: > + Pulseaudio +--- + +- List outputs : `pacmd list-sinks | grep -e 'name:' -e 'index'` +- Select a new one : `pacmd set-default-sink alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo` + diff --git a/content/en/blog/miscellaneous/purge-postfix-queue-based-content.md b/content/en/blog/miscellaneous/purge-postfix-queue-based-content.md new file mode 100644 index 0000000..2db52ac --- /dev/null +++ b/content/en/blog/miscellaneous/purge-postfix-queue-based-content.md @@ -0,0 +1,13 @@ +--- +title: "Purge postfix queue based on email contents" +linkTitle: "Purge postfix queue based on email contents" +date: 2009-04-27 +description: > + Purge postfix queue based on email contents +--- + + +{{< highlight sh >}} +find /var/spool/postfix/deferred/ -type f -exec grep -li 'XXX' '{}' \; | xargs -n1 basename | xargs -n1 postsuper -d +{{< /highlight >}} + diff --git a/content/en/blog/miscellaneous/qmail.md b/content/en/blog/miscellaneous/qmail.md new file mode 100644 index 0000000..6a28f1a --- /dev/null +++ b/content/en/blog/miscellaneous/qmail.md @@ -0,0 +1,21 @@ +--- +title: "Qmail" +linkTitle: "Qmail" +date: 2018-03-05 +description: > + Qmail +--- + +## Commands + +- Get statistics : `qmail-qstat` +- list queued mails : `qmail-qread` +- Read an email in the queue (NNNN is the #id from qmail-qread) : `find /var/qmail/queue -name NNNN| xargs cat | less` +- Change queue lifetime for qmail in seconds (example here for 15 days) : `echo 1296000 > /var/qmail/control/queuelifetime` + +## References + +- http://www.lifewithqmail.org/lwq.html +- http://www.fileformat.info/tip/linux/qmailnow.htm +- https://www.hivelocity.net/kb/how-to-change-queue-lifetime-for-qmail/ + diff --git a/content/en/blog/miscellaneous/rocketchat.md b/content/en/blog/miscellaneous/rocketchat.md new file mode 100644 index 0000000..072658d --- /dev/null +++ b/content/en/blog/miscellaneous/rocketchat.md @@ -0,0 +1,18 @@ +--- +title: "RocketChat" +linkTitle: "RocketChat" +date: 2019-08-06 +description: > + RocketChat +--- + +Docker simple install : +{{< highlight sh >}} +docker run --name db -d mongo --smallfiles --replSet hurricane + +docker exec -ti db mongo +> rs.initiate() + +docker run -p 3000:3000 --name rocketchat --env ROOT_URL=http://hurricane --env MONGO_OPLOG_URL=mongodb://db:27017/local?replSet=hurricane --link db -d rocket.chat +{{< /highlight >}} + diff --git a/content/en/blog/miscellaneous/screen-cannot-open-terminal.md b/content/en/blog/miscellaneous/screen-cannot-open-terminal.md new file mode 100644 index 0000000..7622191 --- /dev/null +++ b/content/en/blog/miscellaneous/screen-cannot-open-terminal.md @@ -0,0 +1,17 @@ +--- +title: "Screen cannot open terminal error" +linkTitle: "Screen cannot open terminal error" +date: 2018-07-03 +description: > + Screen cannot open terminal error +--- + +If you encounter : +{{< highlight sh >}} +Cannot open your terminal '/dev/pts/0' - please check. +{{< /highlight >}} + +Then you did not open the shell with the user you logged in with. You can make screen happy by running : +{{< highlight sh >}} +script /dev/null +{{< /highlight >}} diff --git a/content/en/blog/miscellaneous/seti-at-home.md b/content/en/blog/miscellaneous/seti-at-home.md new file mode 100644 index 0000000..a8d1cf8 --- /dev/null +++ b/content/en/blog/miscellaneous/seti-at-home.md @@ -0,0 +1,18 @@ +--- +title: "Seti@Home" +linkTitle: "Seti@Home" +date: 2018-03-05 +description: > + Seti@Home +--- + +{{< highlight sh >}} +apt install boinc +echo "graou" > /var/lib/boinc-client/gui_rpc_auth.cfg +systemctl restart boinc-client +boinccmd --host localhost --passwd graou --get_messages 0 +boinccmd --host localhost --passwd graou --get_state|less +boinccmd --host localhost --passwd graou --lookup_account http://setiathome.berkeley.edu XXXXXX +boinccmd --host localhost --passwd graou --project_attach http://setiathome.berkeley.edu +{{< /highlight >}} + diff --git a/content/en/blog/miscellaneous/sqlite-pretty-print.md b/content/en/blog/miscellaneous/sqlite-pretty-print.md new file mode 100644 index 0000000..08bcec6 --- /dev/null +++ b/content/en/blog/miscellaneous/sqlite-pretty-print.md @@ -0,0 +1,16 @@ +--- +title: "Sqlite pretty print" +linkTitle: "Sqlite pretty print" +date: 2019-06-19 +description: > + Sqlite pretty print +--- + +- In ~/.sqliterc : +{{< highlight sh >}} +.mode column +.headers on +.separator ROW "\n" +.nullvalue NULL +{{< /highlight >}} + diff --git a/content/en/blog/miscellaneous/switching-to-hugo.md b/content/en/blog/miscellaneous/switching-to-hugo.md new file mode 100755 index 0000000..1bb0c43 --- /dev/null +++ b/content/en/blog/miscellaneous/switching-to-hugo.md @@ -0,0 +1,7 @@ +--- +title: "Switching to Hugo" +linkTitle: "Switching to Hugo" +date: 2019-12-19 +description: > + I switched my personal wiki from dokuwiki to Hugo +--- -- cgit v1.2.3