Ravas coding goodies

For discussions about programming and projects not necessarily associated with Porteus.
User avatar
Rava
Contributor
Contributor
Posts: 3268
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#61 by Rava » 09 Nov 2021, 02:54

Ed_P wrote:
08 Nov 2021, 17:04
Rava wrote:
08 Nov 2021, 05:38
Neat they could name the parameters AB and C for after before and context.
:D
It makes it easier to remember.

<_<Image<_<

Then again, only recalling -C is often enough, better one or two lines too much context than one crucial line missing, be it above or below the hit.
Usually I use -C num with num > 1 unless I want a text screenshot e.g. for a forum article or for a documentation and I want the precise quote, then it could be I use -A or -B instead of -C. But for just getting the needed info, -C is more often than not the most easy way of getting it, and like I said: having more irrelevant lines is of no consequence when you still get the info you need.
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3268
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#62 by Rava » 10 Nov 2021, 02:27

I put this into the HOWTO area of the forum, so kind of a symlink to it in here as well:
[HOWTO] get special characters not on your keyboard via Shift+Ctrl+U+"X"+number hack
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3268
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#63 by Rava » 11 Nov 2021, 19:59

Let's presume your image viewer is viewnior.

Let's also presume your images are all in /graphics

You have several dozens of subfolders sorting /graphics into subcategories, e.g. photos/ drawings/ camera/ and whatnot. You have thousands or tens of thousands of graphic image files in /graphics overall.

If you kept a certain naming convention, you can easily view all images that follow a certain convention regardless in which subfolder/ or sub/sub/subfolder/ they actually might be.

Let's also presume part of the file names you want to watch is Screenshot1280 e.g. Screenshot1280x720_01.jpg or Screenshot1280x1024_02.webp .

You only have to open an Xterminal

Code: Select all

cd /graphics
viewnior 2>/dev/null $(find . -name '*Screenshot1280*')
Why do I use the error redirection into the garbage bin aka 2>/dev/null ? Because some images give annoying warning info, e.g. all webp, at least in my x86-64 5.0rc3 current setup.

Cave! For your viewnior to be able to support webp you have to give your system webp support since viewnior supports all image formats supported by certain system resources. Somewhere on here is a thread about how that's done.
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3268
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#64 by Rava » 13 Nov 2021, 07:53

Today is a smaller, more basic matter. :)

Code: Select all

guest@porteus:/$ cp /tmp/psinfo_report.txt /5/porteus/debug/5.0_/2021-11-13_psinfo_report_Toshiba4CodeSatellite.txt
guest@porteus:/$ ls -l /5/porteus/debug/5.0_/2021-11-13_psinfo_report_Toshiba4CodeSatellite.txt /tmp/psinfo_report.txt
-rw-r--r-- 1 guest users 478825 Nov 13 07:51 /5/porteus/debug/5.0_/2021-11-13_psinfo_report_Toshiba4CodeSatellite.txt
-rw-r--r-- 1 root  root  478825 Nov 13 07:51 /tmp/psinfo_report.txt
As you can see:
A non-root-user like guest group users can copy a file owned by root and set his own user and group info to it as long as he can read it.
Of course user guest could not remove /tmp/psinfo_report.txt nor alter /tmp/psinfo_report.txt :

Code: Select all

guest@porteus:/$ rm /tmp/psinfo_report.txt
rm: remove write-protected regular file '/tmp/psinfo_report.txt'? y
rm: cannot remove '/tmp/psinfo_report.txt': Operation not permitted
guest@porteus:/$ echo TEST >>/tmp/psinfo_report.txt
bash: /tmp/psinfo_report.txt: Permission denied
Cheers!
Yours Rava

Post Reply