From ed8e2b9e9ed67097d4fdc7913df1c6cd2d96d3f7 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Fri, 12 Mar 2021 18:12:41 +0100 Subject: Some more articles reformatting --- content/blog/miscellaneous/bash-tcp-client.md | 2 +- content/blog/miscellaneous/i3dropdown.md | 9 +++++---- content/blog/miscellaneous/libreoffice.md | 14 ++++++++++---- content/blog/miscellaneous/link-deleted-inode.md | 19 +++++++++++++++---- content/blog/miscellaneous/make.md | 9 +++++---- content/blog/miscellaneous/mencoder.md | 10 ++++++---- content/blog/miscellaneous/mssql-centos-7.md | 16 ++++++++++++---- .../miscellaneous/my-postgresql-role-cannot-login.md | 14 ++++++++++---- content/blog/miscellaneous/nginx-ldap.md | 9 +++++---- content/blog/miscellaneous/osm-overlay-example.md | 16 ++++++++++++---- content/blog/miscellaneous/pleroma.md | 10 +++++++--- content/blog/miscellaneous/postgresql-read-only.md | 13 +++++++------ content/blog/miscellaneous/postgresql-reassign.md | 9 ++++++--- content/blog/miscellaneous/pulseaudio.md | 9 +++++---- .../purge-postfix-queue-based-content.md | 13 +++++++++---- content/blog/miscellaneous/qmail.md | 7 +++---- content/blog/miscellaneous/rocketchat.md | 14 ++++++++++---- .../blog/miscellaneous/screen-cannot-open-terminal.md | 17 ++++++++++++----- content/blog/miscellaneous/seti-at-home.md | 13 +++++++++---- content/blog/miscellaneous/sqlite-pretty-print.md | 10 +++++----- content/blog/miscellaneous/switching-to-hugo.md | 8 +++++--- 21 files changed, 159 insertions(+), 82 deletions(-) (limited to 'content/blog/miscellaneous') diff --git a/content/blog/miscellaneous/bash-tcp-client.md b/content/blog/miscellaneous/bash-tcp-client.md index cfcd1df..2f31d14 100644 --- a/content/blog/miscellaneous/bash-tcp-client.md +++ b/content/blog/miscellaneous/bash-tcp-client.md @@ -3,7 +3,7 @@ title: "Bash tcp client" date: 2018-03-21 description: Bash tcp client tags: - - simple utilities + - toolbox --- ## Having some fun with bash diff --git a/content/blog/miscellaneous/i3dropdown.md b/content/blog/miscellaneous/i3dropdown.md index 52262ec..0ffbe35 100644 --- a/content/blog/miscellaneous/i3dropdown.md +++ b/content/blog/miscellaneous/i3dropdown.md @@ -1,11 +1,13 @@ --- title: "i3dropdown" -linkTitle: "i3dropdown" date: 2020-01-23 -description: > - i3dropdown +description: How to use i3dropdown to pump up your graphical environment +tags: + - toolbox --- +## Introduction + 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 @@ -29,4 +31,3 @@ bindsym Mod4+shift+p exec /home/julien/bin/i3dropdown -W 90 -H 50 pavucontrol pa 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/blog/miscellaneous/libreoffice.md b/content/blog/miscellaneous/libreoffice.md index 29b8541..5a26e25 100644 --- a/content/blog/miscellaneous/libreoffice.md +++ b/content/blog/miscellaneous/libreoffice.md @@ -1,9 +1,15 @@ --- title: "Removing libreoffice write protection" -linkTitle: "Removing libreoffice write protection" date: 2018-03-05 -description: > - Removing libreoffice write protection +description: How to remove libreoffice write protection on a document +tags: + - toolbox --- -You can choose to ignore write-protection by setting `Tools > Options > libreOffice Writer > Formatting Aids > Protected Areas > Ignore protection`. +## The problem + +Sometimes you have to edit a corporate document which vim cannot really open for edition and you are dumbstruck as to why the software won't just let you make your changes without jumping through hoops. + +## The solution + +You can choose to ignore write-protection by setting `Tools > Options > libreOffice Writer > Formatting Aids > Protected Areas > Ignore protection`. Yes, so much menu nesting for something so stupid! diff --git a/content/blog/miscellaneous/link-deleted-inode.md b/content/blog/miscellaneous/link-deleted-inode.md index 45f0417..1cba1af 100644 --- a/content/blog/miscellaneous/link-deleted-inode.md +++ b/content/blog/miscellaneous/link-deleted-inode.md @@ -1,10 +1,21 @@ --- title: "Link to a deleted inode" -linkTitle: "Link to a deleted inode" date: 2018-03-05 -description: > - Link to a deleted inode +description: How to restore a hardlink to a deleted inode +tags: + - unix --- -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). The path is relative to the root of the block device you are restoring onto. +## The problem +Sometimes a file gets deleted by mistake, but thankfully it is still opened by some software. + +## The solution + +Get the inode number from `lsof` (or from `fstat` if you are on a modern system), then run something like the following : + +{{< highlight sh >}} +debugfs -w /dev/mapper/vg-home -R 'link <16008> /some/path' +{{< /highlight >}} + +In this example 16008 is the inode number you want to link to (the < > are important, they tell debugfs you are manipulating an inode). Beware that **the path is relative to the root of the block device** you are restoring onto. diff --git a/content/blog/miscellaneous/make.md b/content/blog/miscellaneous/make.md index 0795127..c864de8 100644 --- a/content/blog/miscellaneous/make.md +++ b/content/blog/miscellaneous/make.md @@ -1,10 +1,11 @@ --- title: "Understanding make" -linkTitle: "Understanding make" date: 2018-01-30 -description: > - Understanding make +description: A link to a great article for understanding make +tags: + - toolbox --- -http://gromnitsky.users.sourceforge.net/articles/notes-for-new-make-users/ +## The article +Here is a link to a great article for understanding make : http://gromnitsky.users.sourceforge.net/articles/notes-for-new-make-users/ diff --git a/content/blog/miscellaneous/mencoder.md b/content/blog/miscellaneous/mencoder.md index 4bb8fd0..4eeb5a9 100644 --- a/content/blog/miscellaneous/mencoder.md +++ b/content/blog/miscellaneous/mencoder.md @@ -1,12 +1,14 @@ --- -title: "Aggregate images into a video with mencoder" -linkTitle: "Aggregate images into a video with mencoder" +title: "Turning images into a video with mencoder" date: 2018-04-30 -description: > - Aggregate images into a video withmencoder +description: How to turn images into a video with mencoder +tags: + - toolbox --- ## Aggregate png images into a video + +Example command : {{< 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 >}} diff --git a/content/blog/miscellaneous/mssql-centos-7.md b/content/blog/miscellaneous/mssql-centos-7.md index 019f442..8ba44e6 100644 --- a/content/blog/miscellaneous/mssql-centos-7.md +++ b/content/blog/miscellaneous/mssql-centos-7.md @@ -1,11 +1,20 @@ --- title: "Installing mssql on centos 7" -linkTitle: "Installing mssql on centos 7" date: 2019-07-09 -description: > - Installing mssql on centos 7 +description: How to install mssql on centos 7 +tags: + - Centos + - rhel + - toolbox --- +## Disclaimer + +I had to do this in order to help a friend, I do not think I would ever willingly put mssql in production unless I went crazy. + +## Procedure + +Here is how to setup mssql on a fresh centos 7 {{< highlight sh >}} vi /etc/sysconfig/network-scripts/ifcfg-eth0 vi /etc/resolv.conf @@ -26,4 +35,3 @@ 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/blog/miscellaneous/my-postgresql-role-cannot-login.md b/content/blog/miscellaneous/my-postgresql-role-cannot-login.md index 2b958bf..d85f3bf 100644 --- a/content/blog/miscellaneous/my-postgresql-role-cannot-login.md +++ b/content/blog/miscellaneous/my-postgresql-role-cannot-login.md @@ -1,12 +1,18 @@ --- title: "Cannot login role into postgresql" -linkTitle: "Cannot login role into postgresql" date: 2015-11-24 -description: > - Cannot login role into postgresql +description: How to fix a "Cannot login role" error on postgresql +tags: + - PostgreSQL --- +## The problem + +Login is a permission on postgresql, that sometimes is not obvious it can cause issues. + +## The solution + +Simply log in as postgres or another administrator account and run : {{< highlight sh >}} ALTER ROLE "user" LOGIN; {{< /highlight >}} - diff --git a/content/blog/miscellaneous/nginx-ldap.md b/content/blog/miscellaneous/nginx-ldap.md index b480943..e9135c7 100644 --- a/content/blog/miscellaneous/nginx-ldap.md +++ b/content/blog/miscellaneous/nginx-ldap.md @@ -1,11 +1,13 @@ --- title: "LDAP auth with nginx" -linkTitle: "LDAP auth with nginx" date: 2018-03-05 -description: > - LDAP auth with nginx +description: How to setup LDAP authentication with nginx +tags: + - nginx --- +## How to + {{< highlight sh >}} ldap_server ldap { auth_ldap_cache_enabled on; @@ -22,4 +24,3 @@ ldap_server ldap { #require group "cn=admins,ou=groups,dc=adyxax,dc=org"; } {{< /highlight >}} - diff --git a/content/blog/miscellaneous/osm-overlay-example.md b/content/blog/miscellaneous/osm-overlay-example.md index 2787a6e..de31d95 100644 --- a/content/blog/miscellaneous/osm-overlay-example.md +++ b/content/blog/miscellaneous/osm-overlay-example.md @@ -1,12 +1,18 @@ --- title: "OpenStreetMap overlay example" -linkTitle: "OpenStreetMap overlay example" date: 2020-05-19 -description: > - An example of how to query things visually on OpenStreetMap +description: An example of how to query things visually on OpenStreetMap +tags: + - toolbox --- -http://overpass-turbo.eu/ +## The problem + +OpenStreetMap is a great resource and there is a lot more information stored there than you can easily see. + +## The solution + +Go to http://overpass-turbo.eu/ and enter a filter script similar to the following : {{< highlight html >}} @@ -17,3 +23,5 @@ http://overpass-turbo.eu/ {{< /highlight >}} + +This example will highlight the recycling points near a target location. From there you can build almost any filter you can think of! diff --git a/content/blog/miscellaneous/pleroma.md b/content/blog/miscellaneous/pleroma.md index 91c10f8..28ac365 100644 --- a/content/blog/miscellaneous/pleroma.md +++ b/content/blog/miscellaneous/pleroma.md @@ -1,14 +1,17 @@ --- title: "Pleroma installation notes" -linkTitle: "Pleroma installation notes" date: 2018-11-16 -description: > - Pleroma installation notes +description: How to install pleroma +tags: + - toolbox --- +## Introduction + 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 @@ -46,6 +49,7 @@ curl http://localhost:4000/api/v1/instance 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; diff --git a/content/blog/miscellaneous/postgresql-read-only.md b/content/blog/miscellaneous/postgresql-read-only.md index c064e97..0b88d90 100644 --- a/content/blog/miscellaneous/postgresql-read-only.md +++ b/content/blog/miscellaneous/postgresql-read-only.md @@ -1,17 +1,18 @@ --- title: "Grant postgresql read only access" -linkTitle: "Grant postgresql read only access" date: 2015-11-24 -description: > - Grant postgresql read only access +description: How to grant read only access to a postgresql user +tags: + - PostgreSQL --- +## The solution + +Here is the bare minimum a user need in order to have complete read only access on a postgresql database : {{< 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"; +ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO "user"; {{< /highlight >}} - diff --git a/content/blog/miscellaneous/postgresql-reassign.md b/content/blog/miscellaneous/postgresql-reassign.md index 7779c40..b794442 100644 --- a/content/blog/miscellaneous/postgresql-reassign.md +++ b/content/blog/miscellaneous/postgresql-reassign.md @@ -1,11 +1,14 @@ --- 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 +description: How to change owner on a postgresql database and all tables +tags: + - PostgreSQL --- +## The solution + +Here is the sequence of commande that will change the owner of all objects in a database from a user named "support" to another named "test-support": {{< 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 diff --git a/content/blog/miscellaneous/pulseaudio.md b/content/blog/miscellaneous/pulseaudio.md index c656275..cd70fbb 100644 --- a/content/blog/miscellaneous/pulseaudio.md +++ b/content/blog/miscellaneous/pulseaudio.md @@ -1,11 +1,12 @@ --- title: "Pulseaudio" -linkTitle: "Pulseaudio" date: 2018-09-25 -description: > - Pulseaudio +description: Some pulseaudio commands +tags: + - linux --- +## The commands + - 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/blog/miscellaneous/purge-postfix-queue-based-content.md b/content/blog/miscellaneous/purge-postfix-queue-based-content.md index 2db52ac..d131af2 100644 --- a/content/blog/miscellaneous/purge-postfix-queue-based-content.md +++ b/content/blog/miscellaneous/purge-postfix-queue-based-content.md @@ -1,13 +1,18 @@ --- 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 +description: How to selectively purge a postfix queue based on email contents +tags: + - toolbox --- +## The problem +Sometimes a lot of spam can acacumulate in a postfix queue. + +## The solution + +Here is a command that can search through queued emails for a certain character string (here XXX as an example) and delete the ones that contain it : {{< 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/blog/miscellaneous/qmail.md b/content/blog/miscellaneous/qmail.md index 6a28f1a..37dcd48 100644 --- a/content/blog/miscellaneous/qmail.md +++ b/content/blog/miscellaneous/qmail.md @@ -1,9 +1,9 @@ --- title: "Qmail" -linkTitle: "Qmail" date: 2018-03-05 -description: > - Qmail +description: Some qmail commands +tags: + - toolbox --- ## Commands @@ -18,4 +18,3 @@ description: > - 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/blog/miscellaneous/rocketchat.md b/content/blog/miscellaneous/rocketchat.md index 072658d..d0cc370 100644 --- a/content/blog/miscellaneous/rocketchat.md +++ b/content/blog/miscellaneous/rocketchat.md @@ -1,11 +1,18 @@ --- title: "RocketChat" -linkTitle: "RocketChat" date: 2019-08-06 -description: > - RocketChat +description: How to quickly setup a RocketChat container with docker +tags: + - docker + - toolbox --- +## The problem + +I needed to test some scripts that interact with a rocketchat instance at work. The documentation was lacking especially the mongo initiate part so here is how I did it. + +## The commands + Docker simple install : {{< highlight sh >}} docker run --name db -d mongo --smallfiles --replSet hurricane @@ -15,4 +22,3 @@ docker exec -ti db mongo 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/blog/miscellaneous/screen-cannot-open-terminal.md b/content/blog/miscellaneous/screen-cannot-open-terminal.md index 7622191..5584538 100644 --- a/content/blog/miscellaneous/screen-cannot-open-terminal.md +++ b/content/blog/miscellaneous/screen-cannot-open-terminal.md @@ -1,17 +1,24 @@ --- title: "Screen cannot open terminal error" -linkTitle: "Screen cannot open terminal error" date: 2018-07-03 -description: > - Screen cannot open terminal error +description: How to fix a "Screen cannot open terminal" error +tags: + - toolbox + - unix --- -If you encounter : +## The problem + +At my current workplace there are die hard screen fanatics that refuse to upgrade to tmux. Sometimes I get the following error : {{< 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 : +## The solution + +This error means that 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 >}} + +In this new environment your screen commands will work normally. diff --git a/content/blog/miscellaneous/seti-at-home.md b/content/blog/miscellaneous/seti-at-home.md index a8d1cf8..c94b804 100644 --- a/content/blog/miscellaneous/seti-at-home.md +++ b/content/blog/miscellaneous/seti-at-home.md @@ -1,11 +1,17 @@ --- title: "Seti@Home" -linkTitle: "Seti@Home" date: 2018-03-05 -description: > - Seti@Home +description: Getting back into Seti@Home 15 years later +tags: + - toolbox --- +## Introduction + +Me and some friends were feeling nostalgics of running Seti@Home as a screensaver in the early 2000s and were delighted to see that the project is still alive and kicking. + +## The commands + {{< highlight sh >}} apt install boinc echo "graou" > /var/lib/boinc-client/gui_rpc_auth.cfg @@ -15,4 +21,3 @@ 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/blog/miscellaneous/sqlite-pretty-print.md b/content/blog/miscellaneous/sqlite-pretty-print.md index 08bcec6..bc7ea02 100644 --- a/content/blog/miscellaneous/sqlite-pretty-print.md +++ b/content/blog/miscellaneous/sqlite-pretty-print.md @@ -1,16 +1,16 @@ --- title: "Sqlite pretty print" -linkTitle: "Sqlite pretty print" date: 2019-06-19 -description: > - Sqlite pretty print +description: How to pretty print your Sqlite output +tags: + - SQLite --- -- In ~/.sqliterc : +## The solution +In `~/.sqliterc` add the following : {{< highlight sh >}} .mode column .headers on .separator ROW "\n" .nullvalue NULL {{< /highlight >}} - diff --git a/content/blog/miscellaneous/switching-to-hugo.md b/content/blog/miscellaneous/switching-to-hugo.md index 739b36d..dc2841f 100644 --- a/content/blog/miscellaneous/switching-to-hugo.md +++ b/content/blog/miscellaneous/switching-to-hugo.md @@ -1,11 +1,13 @@ --- title: "Switching to Hugo" -linkTitle: "Switching to Hugo" date: 2019-12-19 -description: > - I switched my personal wiki from dokuwiki to Hugo +description: I switched my personal wiki from dokuwiki to Hugo +tags: + - hugo --- +## Introduction + This is the website you are currently reading. It is a static website built using hugo. This article details how I installed hugo, how I initialised this website and how I manage it. I often refer to it as wiki.adyxax.org because I hosted a unique dokuwiki for a long time as my main website (and a pmwiki before that), but with hugo it has become more than that. It is now a mix of wiki, blog and showcase of my work and interests. ## Installing hugo -- cgit v1.2.3