Some more articles reformatting

This commit is contained in:
Julien Dessaux 2021-03-12 18:12:41 +01:00
parent af1088fca1
commit ed8e2b9e9e
31 changed files with 174 additions and 102 deletions

View file

@ -4,7 +4,7 @@ date: 2019-04-16
description: How to serve static files from only busybox description: How to serve static files from only busybox
tags: tags:
- linux - linux
- simple utilities - toolbox
--- ---
## The command ## The command

View file

@ -3,7 +3,7 @@ title: "Convert unix timestamp to readable date"
date: 2011-01-06 date: 2011-01-06
description: the -d flag of the date command combined with @timestamp description: the -d flag of the date command combined with @timestamp
tags: tags:
- simple utilities - toolbox
--- ---
## The trick ## The trick

View file

@ -3,7 +3,7 @@ title: "DMIdecode"
date: 2011-02-16 date: 2011-02-16
description: Some DMIdecode common flags description: Some DMIdecode common flags
tags: tags:
- simple utilities - toolbox
--- ---
## Introduction ## Introduction

View file

@ -3,8 +3,8 @@ title: "Find hardlinks to a same file"
date: 2018-03-02 date: 2018-03-02
description: How to list hardlinks that link to the same file description: How to list hardlinks that link to the same file
tags: tags:
- find - toolbox
- simple utilities - unix
--- ---
{{< highlight sh >}} {{< highlight sh >}}

View file

@ -3,8 +3,8 @@ title: "Find where inodes are used"
date: 2018-04-25 date: 2018-04-25
description: How to locate what is taking all the inodes in the subdirectory of a given device description: How to locate what is taking all the inodes in the subdirectory of a given device
tags: tags:
- find - toolbox
- simple utilities - unix
--- ---
{{< highlight sh >}} {{< highlight sh >}}

View file

@ -3,7 +3,7 @@ title: "ipmitool"
date: 2018-03-05 date: 2018-03-05
description: some ipmitool command examples description: some ipmitool command examples
tags: tags:
- simple utilities - toolbox
--- ---
## Usage examples ## Usage examples

View file

@ -4,7 +4,7 @@ date: 2011-11-15
description: some mdadm command examples description: some mdadm command examples
tags: tags:
- linux - linux
- simple utilities - toolbox
--- ---
## Watch the array status ## Watch the array status

View file

@ -3,7 +3,7 @@ title: "rrdtool"
date: 2018-09-25 date: 2018-09-25
description: How to graph manually with rrdtool description: How to graph manually with rrdtool
tags: tags:
- simple utilities - toolbox
--- ---
## Graph manually ## Graph manually

View file

@ -3,7 +3,7 @@ title: "Bash tcp client"
date: 2018-03-21 date: 2018-03-21
description: Bash tcp client description: Bash tcp client
tags: tags:
- simple utilities - toolbox
--- ---
## Having some fun with bash ## Having some fun with bash

View file

@ -1,11 +1,13 @@
--- ---
title: "i3dropdown" title: "i3dropdown"
linkTitle: "i3dropdown"
date: 2020-01-23 date: 2020-01-23
description: > description: How to use i3dropdown to pump up your graphical environment
i3dropdown 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. 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 ## 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 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. 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.

View file

@ -1,9 +1,15 @@
--- ---
title: "Removing libreoffice write protection" title: "Removing libreoffice write protection"
linkTitle: "Removing libreoffice write protection"
date: 2018-03-05 date: 2018-03-05
description: > description: How to remove libreoffice write protection on a document
Removing libreoffice write protection 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!

View file

@ -1,10 +1,21 @@
--- ---
title: "Link to a deleted inode" title: "Link to a deleted inode"
linkTitle: "Link to a deleted inode"
date: 2018-03-05 date: 2018-03-05
description: > description: How to restore a hardlink to a deleted inode
Link 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.

View file

@ -1,10 +1,11 @@
--- ---
title: "Understanding make" title: "Understanding make"
linkTitle: "Understanding make"
date: 2018-01-30 date: 2018-01-30
description: > description: A link to a great article for understanding make
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/

View file

@ -1,12 +1,14 @@
--- ---
title: "Aggregate images into a video with mencoder" title: "Turning images into a video with mencoder"
linkTitle: "Aggregate images into a video with mencoder"
date: 2018-04-30 date: 2018-04-30
description: > description: How to turn images into a video with mencoder
Aggregate images into a video withmencoder tags:
- toolbox
--- ---
## Aggregate png images into a video ## Aggregate png images into a video
Example command :
{{< highlight sh >}} {{< 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 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 >}} {{< /highlight >}}

View file

@ -1,11 +1,20 @@
--- ---
title: "Installing mssql on centos 7" title: "Installing mssql on centos 7"
linkTitle: "Installing mssql on centos 7"
date: 2019-07-09 date: 2019-07-09
description: > description: How to install mssql on centos 7
Installing 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 >}} {{< highlight sh >}}
vi /etc/sysconfig/network-scripts/ifcfg-eth0 vi /etc/sysconfig/network-scripts/ifcfg-eth0
vi /etc/resolv.conf vi /etc/resolv.conf
@ -26,4 +35,3 @@ rm -f /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -p /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -p
{{< /highlight >}} {{< /highlight >}}

View file

@ -1,12 +1,18 @@
--- ---
title: "Cannot login role into postgresql" title: "Cannot login role into postgresql"
linkTitle: "Cannot login role into postgresql"
date: 2015-11-24 date: 2015-11-24
description: > description: How to fix a "Cannot login role" error on postgresql
Cannot login role into 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 >}} {{< highlight sh >}}
ALTER ROLE "user" LOGIN; ALTER ROLE "user" LOGIN;
{{< /highlight >}} {{< /highlight >}}

View file

@ -1,11 +1,13 @@
--- ---
title: "LDAP auth with nginx" title: "LDAP auth with nginx"
linkTitle: "LDAP auth with nginx"
date: 2018-03-05 date: 2018-03-05
description: > description: How to setup LDAP authentication with nginx
LDAP auth with nginx tags:
- nginx
--- ---
## How to
{{< highlight sh >}} {{< highlight sh >}}
ldap_server ldap { ldap_server ldap {
auth_ldap_cache_enabled on; auth_ldap_cache_enabled on;
@ -22,4 +24,3 @@ ldap_server ldap {
#require group "cn=admins,ou=groups,dc=adyxax,dc=org"; #require group "cn=admins,ou=groups,dc=adyxax,dc=org";
} }
{{< /highlight >}} {{< /highlight >}}

View file

@ -1,12 +1,18 @@
--- ---
title: "OpenStreetMap overlay example" title: "OpenStreetMap overlay example"
linkTitle: "OpenStreetMap overlay example"
date: 2020-05-19 date: 2020-05-19
description: > description: An example of how to query things visually on OpenStreetMap
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 >}} {{< highlight html >}}
<osm-script> <osm-script>
<query type="node"> <query type="node">
@ -17,3 +23,5 @@ http://overpass-turbo.eu/
<print mode="body"/> <print mode="body"/>
</osm-script> </osm-script>
{{< /highlight >}} {{< /highlight >}}
This example will highlight the recycling points near a target location. From there you can build almost any filter you can think of!

View file

@ -1,14 +1,17 @@
--- ---
title: "Pleroma installation notes" title: "Pleroma installation notes"
linkTitle: "Pleroma installation notes"
date: 2018-11-16 date: 2018-11-16
description: > description: How to install pleroma
Pleroma installation notes tags:
- toolbox
--- ---
## Introduction
This article is about my installation of pleroma in a standard alpine linux lxd container. This article is about my installation of pleroma in a standard alpine linux lxd container.
## Installation notes ## Installation notes
{{< highlight sh >}} {{< 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 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 /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 : 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 >}} {{< highlight sh >}}
### in nginx.conf inside the container ### ### in nginx.conf inside the container ###
# {{{ pleroma # {{{ 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; 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;

View file

@ -1,17 +1,18 @@
--- ---
title: "Grant postgresql read only access" title: "Grant postgresql read only access"
linkTitle: "Grant postgresql read only access"
date: 2015-11-24 date: 2015-11-24
description: > description: How to grant read only access to a postgresql user
Grant postgresql read only access 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 >}} {{< highlight sh >}}
GRANT CONNECT ON DATABASE "db" TO "user"; GRANT CONNECT ON DATABASE "db" TO "user";
\c db \c db
GRANT USAGE ON SCHEMA public TO "user"; GRANT USAGE ON SCHEMA public TO "user";
GRANT SELECT ON ALL TABLES IN SCHEMA public TO "user"; GRANT SELECT ON ALL TABLES IN SCHEMA public TO "user";
ALTER DEFAULT PRIVILEGES IN SCHEMA public ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO "user";
GRANT SELECT ON TABLES TO "user";
{{< /highlight >}} {{< /highlight >}}

View file

@ -1,11 +1,14 @@
--- ---
title: "Change owner on a postgresql database and all tables" title: "Change owner on a postgresql database and all tables"
linkTitle: "Change owner on a postgresql database and all tables"
date: 2012-04-20 date: 2012-04-20
description: > description: How to change owner on a postgresql database and all tables
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 >}} {{< highlight sh >}}
ALTER DATABASE name OWNER TO new_owner 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 tablename from pg_tables where schemaname = 'public';" YOUR_DB` ; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done

View file

@ -1,11 +1,12 @@
--- ---
title: "Pulseaudio" title: "Pulseaudio"
linkTitle: "Pulseaudio"
date: 2018-09-25 date: 2018-09-25
description: > description: Some pulseaudio commands
Pulseaudio tags:
- linux
--- ---
## The commands
- List outputs : `pacmd list-sinks | grep -e 'name:' -e 'index'` - 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` - Select a new one : `pacmd set-default-sink alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo`

View file

@ -1,13 +1,18 @@
--- ---
title: "Purge postfix queue based on email contents" title: "Purge postfix queue based on email contents"
linkTitle: "Purge postfix queue based on email contents"
date: 2009-04-27 date: 2009-04-27
description: > description: How to selectively purge a postfix queue based on email contents
Purge 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 >}} {{< highlight sh >}}
find /var/spool/postfix/deferred/ -type f -exec grep -li 'XXX' '{}' \; | xargs -n1 basename | xargs -n1 postsuper -d find /var/spool/postfix/deferred/ -type f -exec grep -li 'XXX' '{}' \; | xargs -n1 basename | xargs -n1 postsuper -d
{{< /highlight >}} {{< /highlight >}}

View file

@ -1,9 +1,9 @@
--- ---
title: "Qmail" title: "Qmail"
linkTitle: "Qmail"
date: 2018-03-05 date: 2018-03-05
description: > description: Some qmail commands
Qmail tags:
- toolbox
--- ---
## Commands ## Commands
@ -18,4 +18,3 @@ description: >
- http://www.lifewithqmail.org/lwq.html - http://www.lifewithqmail.org/lwq.html
- http://www.fileformat.info/tip/linux/qmailnow.htm - http://www.fileformat.info/tip/linux/qmailnow.htm
- https://www.hivelocity.net/kb/how-to-change-queue-lifetime-for-qmail/ - https://www.hivelocity.net/kb/how-to-change-queue-lifetime-for-qmail/

View file

@ -1,11 +1,18 @@
--- ---
title: "RocketChat" title: "RocketChat"
linkTitle: "RocketChat"
date: 2019-08-06 date: 2019-08-06
description: > description: How to quickly setup a RocketChat container with docker
RocketChat 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 : Docker simple install :
{{< highlight sh >}} {{< highlight sh >}}
docker run --name db -d mongo --smallfiles --replSet hurricane 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 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 >}} {{< /highlight >}}

View file

@ -1,17 +1,24 @@
--- ---
title: "Screen cannot open terminal error" title: "Screen cannot open terminal error"
linkTitle: "Screen cannot open terminal error"
date: 2018-07-03 date: 2018-07-03
description: > description: How to fix a "Screen cannot open terminal" error
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 >}} {{< highlight sh >}}
Cannot open your terminal '/dev/pts/0' - please check. Cannot open your terminal '/dev/pts/0' - please check.
{{< /highlight >}} {{< /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 >}} {{< highlight sh >}}
script /dev/null script /dev/null
{{< /highlight >}} {{< /highlight >}}
In this new environment your screen commands will work normally.

View file

@ -1,11 +1,17 @@
--- ---
title: "Seti@Home" title: "Seti@Home"
linkTitle: "Seti@Home"
date: 2018-03-05 date: 2018-03-05
description: > description: Getting back into Seti@Home 15 years later
Seti@Home 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 >}} {{< highlight sh >}}
apt install boinc apt install boinc
echo "graou" > /var/lib/boinc-client/gui_rpc_auth.cfg 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 <EMAIL> XXXXXX boinccmd --host localhost --passwd graou --lookup_account http://setiathome.berkeley.edu <EMAIL> XXXXXX
boinccmd --host localhost --passwd graou --project_attach http://setiathome.berkeley.edu <ACCOUNT_KEY> boinccmd --host localhost --passwd graou --project_attach http://setiathome.berkeley.edu <ACCOUNT_KEY>
{{< /highlight >}} {{< /highlight >}}

View file

@ -1,16 +1,16 @@
--- ---
title: "Sqlite pretty print" title: "Sqlite pretty print"
linkTitle: "Sqlite pretty print"
date: 2019-06-19 date: 2019-06-19
description: > description: How to pretty print your Sqlite output
Sqlite pretty print tags:
- SQLite
--- ---
- In ~/.sqliterc : ## The solution
In `~/.sqliterc` add the following :
{{< highlight sh >}} {{< highlight sh >}}
.mode column .mode column
.headers on .headers on
.separator ROW "\n" .separator ROW "\n"
.nullvalue NULL .nullvalue NULL
{{< /highlight >}} {{< /highlight >}}

View file

@ -1,11 +1,13 @@
--- ---
title: "Switching to Hugo" title: "Switching to Hugo"
linkTitle: "Switching to Hugo"
date: 2019-12-19 date: 2019-12-19
description: > description: I switched my personal wiki from dokuwiki to Hugo
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. 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 ## Installing hugo

View file

@ -1,11 +1,13 @@
--- ---
title: "Investigate memory errors" title: "Investigate memory errors"
linkTitle: "Investigate memory errors"
date: 2018-07-06 date: 2018-07-06
description: > description: How to investigate memory errors on a data ONTAP system
How to investigate memory errors on a data ONTAP system tags:
- netapp
--- ---
## The commands
{{< highlight sh >}} {{< highlight sh >}}
set adv set adv
system node show-memory-errors -node <cluster_node> system node show-memory-errors -node <cluster_node>

View file

@ -1,7 +0,0 @@
---
title: "I am back from New Zealand"
linkTitle: "Back from New Zealand"
date: 2019-12-08
description: >
I am back from New Zealand, after three and a half weeks over there.
---