Skip to content

Instantly share code, notes, and snippets.

@Lahorde
Lahorde / 0_file_explorer_add_metadata.md
Last active Mar 12, 2020
Add some file metadata in linux file explorer
View 0_file_explorer_add_metadata.md

Many PDF file names are not explicit, but their title is. I was looking for a mean to show PDF title in file explorer column (when using detailed view), I posted on stackexchange but did not found any solution I was using Thunar, and I changed file explorer to thunar because some python bindings exists. It is Python nautilus project Just install it, on arch it is python2-nautilus package

After, you have just to read /usr/share/doc/nautilus-python/README And check it works adding copying /usr/share/doc/nautilus-python/examples/block-size-column.py to ~/.local/share/nautilus-python/extensions/ and selectring block-size in column list nautilus preferences.

Now I was sure it was possible some custom columns in nautilus detailed view. It was time to show pdf title. I've tested different python packages to get pdf title :

  • python2-pdfrw package, it cannot decrypt
@Lahorde
Lahorde / 0_monitor_hotplug.md
Last active Aug 31, 2018
Handle several monitor hotplug efficiently
View 0_monitor_hotplug.md

Description

Scripts to configure monitor hotplug. It is useful on a laptop that can be connected to some external screens.

Issues

In some cases, when monitor configuration changes plank position is not updated accordingly. A workaround consist in restarting plank. It is killed from monnitor_hotplug.sh script and automatically restarted using plank_forever.sh script that is started from xfce startup application menu.

References

@Lahorde
Lahorde / 0_raspberry_read_only_filesystem.md
Last active Sep 4, 2018
Raspberry partitioning scheme
View 0_raspberry_read_only_filesystem.md

Raspberry Read Only File System

Description

This gist provides a partitioing scheme and some tips to have a RO protected filesystem on your favorite distribution. It is well suited for Raspberry filesystem as it is stored on an SDCard.

Raspberry case

On several Raspberries I got some failing filesystems after some months of use. Some of it were occasionally rebooted and often rebooted cleanly. Lot of writes to SD were done as it stored some databases. But from what I've read, most of sd card failure causes are :

overclocking

now out of date on recent Raspberry firmware - it was solved in end of 2013

under / over voltage

@Lahorde
Lahorde / 0_samba_shares_offline.md
Last active Aug 31, 2018
Handle efficiently your nfs, samba shares even when it is offline.
View 0_samba_shares_offline.md

Mounting samba shares with this method, https://wiki.archlinux.org/index.php/fstab#Automount_with_systemd gave me some freeze when accessing samba shares when it has been disconnected. Using systemd timeouts does not help : https://bbs.archlinux.org/viewtopic.php?id=225973 .

As an alternative, using https://wiki.archlinux.org/index.php/NetworkManager#Network_services_with_NetworkManager_dispatcher gives some good results : no freeze when shares are offline.

For Samba configuration refer : https://www.tecmint.com/setup-samba-file-sharing-for-linux-windows-clients/

In order to be able to write on shared drives, either configure samba with create mask=0770 Force create mode=0770 or add it to fstab

@Lahorde
Lahorde / check_wifi.sh
Last active Feb 23, 2017
Sometimes on Raspberry, wifi connection cannot be reestablished. Check it and restart netctl auto connection to wlan0 all 5 min with a cron job
View check_wifi.sh
#!/bin/sh
timeout 0.4 ping -c1 google.fr > /dev/null
if [ $? != 0 ]
then
echo "not connected to network"
if iwconfig 2>/dev/null|grep -q wlan0
then
echo 'restart wlan0'
@Lahorde
Lahorde / 0_README.md
Last active Jun 25, 2020
Initialize an external I2C RTC module on raspberry using udev and systemd
View 0_README.md

Description

Enable i2c RTC using systemd. A udev rules triggers an I2C systemd service on I2C kernel module adding. Service then loads I2C driver adding a new I2C device to /sys Then kernel loads I2C RTC driver and adds an RTC device It triggers a udev rules that updates hardware clock

Application on raspberry pi

Enable I2C

  • enable I2C in config.txt, adding device_tree_param=i2c1=on
You can’t perform that action at this time.