GeekTips
109 subscribers
586 photos
3 videos
77 files
231 links
Linux Mint, video encoding, ffmpeg, geek tips, regex, pdf manipulation, substitcher, mpv config
Download Telegram
sharesmb=on | off | opts
Controls whether the file system is shared by using Samba USERSHARES and what options are to be used. Other‐ wise, the file system is automatically shared and unshared with the zfs share and zfs unshare commands. If the property is set to on, the net(8) command is invoked to create a USERSHARE. Because SMB shares requires a resource name, a unique resource name is constructed from the dataset name.

If the sharesmb property is set to off, the file systems are unshared.
The share is created with the ACL (Access Control List) "Everyone:F" ("F" stands for "full permissions", ie. read and write permissions) and no guest access (which means Samba must be able to authenticate a real user, system passwd/shadow, LDAP or smbpasswd based) by default.

zfs set mountpoint=/data zfsbaby/data

zfs set sharesmb=on zfsbaby/data

zfs share zfsbaby/data
verify it's working either remotely or locally

smbclient -U guest -N -L localhost

stop the samba CIFS share

zfs unshare tank/data

disable the share forever

zfs sharesmb=off tank/data

zfs get all

NAME PROPERTY VALUE SOURCE zfsbaby type filesystem - zfsbaby creation Thu Sep 9 23:42 2021 - zfsbaby used 183G - zfsbaby available 6.86T - zfsbaby referenced 183G - zfsbaby compressratio 1.00x - zfsbaby mounted yes - zfsbaby quota none default zfsbaby reservation none default zfsbaby recordsize 128K default zfsbaby mountpoint /zfsbaby default zfsbaby sharenfs off default zfsbaby checksum on default zfsbaby compression lz4 local
zpool status -c lsblk,media
pool: zfsbaby state: ONLINE scan: resilvered 828K in 0 days 00:00:01 with 0 errors on Fri Sep 10 02:59:22 2021 config: NAME        STATE      READ     WRITE    CKSUM      size    vendor    model    media zfsbaby     ONLINE           0              0              0 raidz1-0     ONLINE           0              0              0 sdb            ONLINE           0              0              0      3.7T      WD My_Passport_25E2 hdd sdc            ONLINE           0              0              0      3.7T      WD My_Passport_25E2 hdd sdd            ONLINE           0              0              0     3.7T       WD My_Passport_2626 hdd errors: No known data errors
Scrubbing
ZFS can be scheduled to perform a "scrub" on all the data in a storage pool, checking each piece of data with its corresponding checksum to verify its integrity, detect any silent data corruption and to correct any errors where possible.

When the data is stored in a redundant fashion - in a mirrored or RAIDZ or DRAID-type array - it can be self-healed automatically and since data corruption is logged. Scrubbing is given low I/O priority so that it has a minimal effect on system performance and can operate while the storage pool is in use and online.
Snapshots
An advantage of copy-on-write is that, when ZFS writes new data, the blocks containing the old data can be retained, allowing a snapshot version of the file system to be maintained. ZFS snapshots are created extremely quick, since all the data composing the snapshot is already stored. They are also space efficient, since any unchanged data is shared among the file system and its snapshots. The first snapshot consumes no additional disk space within the pool. As data within the active dataset changes, the snapshot consumes disk space by continuing to reference the old data. As a result, the snapshot prevents the data from being freed back to the pool.

create a snapshot

zfs snapshot zfsbaby data@2022-09-11

destroy a snapshot

zfs destroy zfsbaby/data@2022-09-11
Clones
Writeable snapshots ("clones") can also be created, resulting in two independent file systems that share a set of blocks. As changes are made to any of the clone file systems, new data blocks are created to reflect those changes, but any unchanged blocks continue to be shared, no matter how many clones exist. This is possible due to the copy-on-write design.

Sending & Receiving Snapshots
Snapshots of ZFS file systems and volumes can be sent to remote hosts over the network. This data stream can be an entire file system or volume, or it can be the changes since it was last sent. When sending only the changes, the stream size depends on the number of blocks changed between the snapshots. This provides a very efficient strategy for synchronizing backups.
create a initial snapshot

zfs snapshot zfsbaby/data@initial 

send it (initial snapshot) to another local pool, named ''zfskid'', and calling the dataset ''storage''

zfs send zfsbaby/data@initial | zfs recv -F zfskid/storage 

send it to a remote pool, named ''zfsadult'' at remote side

zfs send zfsbaby/data@initial | ssh remotehost zfs recv -F zfsadult/data 

after using ''zfsbaby/data'' for a week, create another snapshot

zfs snapshot zfsbaby/data@2022-09-18T22-30 

incrementally send the new state to remote

zfs send -i initial zfsbaby/data@2022-09-18T22-30 | ssh remotehost zfs recv -F zfsbaby/data
Add a spare (hot-swap drive) if one fails ZED will tell it to automatically do a sequential resilver.

zpool add -f zfsbaby spare sdg

Add an additional disk to pool

zpool add -f zfsbaby sdg

Replace a corrupted disk (sdg=corrupted sdh=new)

zpool replace zfsbaby sdg sdh

Destroy a pool

zpool destroy zfsbaby 

View Input/Output stats every 11 seconds, ctrl-C stop

zpool iostat 11

Move pool to a new system first export it then import it

zpool export zfsbaby

zpool import zfsbaby

Create a new pool using RAIDZ1 using -f (force) if data on disks

zpool create raidz1 sdb sdc sdd

Create a new pool using RAIDZ2

zpool create raidz2 sdb sdc sdd sde sdf
To remove line breaks, line endings, paragraph marks automatically. If you copy and paste text from a PDF you always get unwanted line breaks and the text doesn't flow.

Best way is to use the online website https://removelinebreaks.net/
as it can convert paragraphs to Double Line

also this one can too
https://anytexteditor.com/remove-line-breaks

But sometimes you need to choose Base number of chars (x) Manual 89 for Double Line to work.

On Linux in LibreOffice Writer
— View - check Formatting Marks to be able to view the Paragraph marks

— Edit / Find & Replace and check Regular expressions ...find: $ and Replace: [space]

But still need to put all the line breaks and double line so it's not a solution. But I finally created a macro in LibreOffice to remove line breaks https://t.iss.one/geektips/270
Firefox I only use two extensions —

for dark mode on websites I use
Dark Background and Light Text
and just press F2 to toggle light/dark mode

Global Preferences
Default foreground color #dcdccc
Default background color #333333
Default link color #ad7fa8
Default visited link color #ffafff
Default active link color #ff0000
Default selection color #d3d7cf

uBlock Origin
which is an ad blocker and any other element on a website you wish to block out.

DownThemAll!
which lets you download all images or mp3s on a web page.

Install then Tools | Add-ons & Themes
Record video from your iphone or ipad. Compile and install rpiplay and start it in a terminal by typing rpiplay
https://github.com/FD-/RPiPlay
type rpiplay to start
to stop it do CTRL-C
then on your ipad or iphone from the menu choose Screen Mirroring
Use SimpleScreenRecorder and make sure PulseAudio is checked if you wish to do voiceover for your video.

https://www.maartenbaert.be/simplescreenrecorder/
use x264 and not x265 to not have any dropped frames. You will want to re-encode it anyway to massively reduce file size with x265. Audio codec Vorbis seemed best at 64kbps.

Sometimes if trying to capture game footage if the ipad screen barely changes but you made a move in the game you have to move the screen a tad for it to detect motion. Doesn't have all the time but it does happen.
this is the ffmpeg command I use in video mass to replace a video audio track with a new audio track

-i "/home/me/Music/musicsong.opus" -c:v hevc -crf 28 -vf scale="-2:720" -c:a copy -strict -2 -map 0:v:0 -map 1:a:0 -map_metadata 0 -shortest
More PDF apps...covered how to highlight / annotate PDFs and reduce the file size of PDFs here https://t.iss.one/geektips/11

To clean metadata from PDFs use metadatacleaner (flatpak is huge like 600MB but what can we do besides compile from source)
https://gitlab.com/rmnvgr/metadata-cleaner/

You can also clean other types of files like images and various office documents. Can't drag and drop files and folders but can do through the file dialog. Works great.

Also has a lightweight option so it doesn't completely change too much but most likely you'll hardly ever have to use it.
On Mac I would use Adobe Acrobat Pro to do OCR and it did the best job especially with a white or light background. If the background was black or dark it would ignore it. It maintained the original layout always.

Linux I use ocrmypdf which is a command line tool
sudo apt install ocrmypdf

ocrmypdf input.pdf output.pdf
It OCRs (Optical character recognition) the file and doesn't touch the images and overlays the text on top of it so it's searchable, selectable and can be copied.
Make PDF booklets or make booklets into linear documents. If you want PDF pages into one page for instance.

https://kjo.herbesfolles.org/bookletimposer/

sudo apt install bookletimposer
Bookletimposer convert this document into a 4 page layout per page.
Bookletimposer here is what it looks like once converted to a 4 page layout
Shotcut Keyboard Reference.pdf
54.7 KB
Shotcut (open source video editor multiplatform). Here is a 2 page PDF keyboard reference for Windows and Linux. I didn't have room for Mac shortcuts unfortunately. PDF is formatted by taking shortcuts from the web page shotcut.org