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
tags:
- linux
- simple utilities
- toolbox
---
## The command

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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

View file

@ -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.

View file

@ -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!

View file

@ -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.

View file

@ -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/

View file

@ -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 >}}

View file

@ -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 >}}

View file

@ -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 >}}

View file

@ -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 >}}

View file

@ -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 >}}
<osm-script>
<query type="node">
@ -17,3 +23,5 @@ http://overpass-turbo.eu/
<print mode="body"/>
</osm-script>
{{< /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"
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;

View file

@ -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 >}}

View file

@ -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

View file

@ -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`

View file

@ -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 >}}

View file

@ -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/

View file

@ -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 >}}

View file

@ -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.

View file

@ -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 <EMAIL> XXXXXX
boinccmd --host localhost --passwd graou --project_attach http://setiathome.berkeley.edu <ACCOUNT_KEY>
{{< /highlight >}}

View file

@ -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 >}}

View file

@ -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

View file

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