Howto

I have a keyboard/mouse/screen switch to connect 2 PCs: one running Linux and one running Windows.

When I connect all the ports, it works, but every time I switch to the Windows laptop, the screen reconfigures, my windows are moved, and it annoys me. The switch behaves as if I had physically unplugged/replugged the screen, and Windows feels compelled to adjust the entire layout!

Udev Webcam 2022.04.01

You can change the device link so your webcam will be always accessible at the same location /dev/video99. You can also persist some settings via the v4l-ctl command.

This days, with 4K monitors, the linux console is unreadable : the font is too small. So how can we scale the font size in the console after boot ?

Local git 2019.12.02

Define a repo somewhere in your file system with a bare init

mkdir -p /somewhere/repo/test_project
cd /somewhere/repo/test_project
git init --bare

Now create a local folder for your work with init only

You can change the mysql prompt client so you know where you are.
Very usefull when you manage a lot of mysql databases and you forget which one :-)

If you use a tiled window manager like me, Suckless DWM for example, and have Firefox as your browser, you may be interested by not showing the tabs.

How to flash any iso (think about your favorite distro) on an USB key without graphical IHM ?

sudo dd if=/path/to/image.iso of=/dev/sda status=progress
  • “/path/to/image.iso” is the path to the ISO file
  • /dev/sda is your USB key device (see below to get yours) : note that it is the whole device, not a partition (e.g. /dev/sda and not /dev/sda1)
  • status=progress show flashing progression

How to know wich device to use ?

ImageMagick logo

As ‘man convert’ states :

The convert program is a member of the ImageMagick suite of tools. Use it to convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.

MySQL

I tried to resync a slave MySQL after it disconnected from the master. But the binary log was already deleted on master, so the only solution was to restore from the last backup. To avoid lock tables on the master and remember the binary log name and position to put them on the slave configuration, there is a tip to take care of all that : the “- master-data” option in mysqldump.

To import a local CSV file into MySQL, use the syntax below :

LOAD DATA LOW_PRIORITY LOCAL INFILE '/path/tofile.csv'
INTO TABLE database.table
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES
(`field1`,`field2`,...)

To export a mysql results in CSV format, use the syntax below :

SELECT field1, field2, ...
FROM table
WHERE condition
INTO OUTFILE '/tmp/toto.csv'
FIELDS TERMINATED BY ';'
ENCLOSED BY '"'
LINES TERMINATED BY '\n' ;