#StackBounty: #linux #command-line #pdf scale pdf to exact size

Bounty: 350

I need a program for Linux which can scale pdf files to a specified size, stretching them if needed. I would prefer a command line program, but something with a gui is ok too.

I found a lot of programs to scale the pdf, but they all scale proportionally, and then just add a white border. But I need something which will stretch the pdf file, so it has the exact needed size without white border.

I know stretching may make the pdf look odd, but I have some pdf files which just need to be a 1.5 mm higher, so it is less then 1% I need to stretch them, so I still think it will look ok.


Get this bounty!!!

#StackBounty: #windows #command-line #terminal #taskbar #desktop Stick a terminal window to the on the desktop

Bounty: 50

For some reason I need to get rid of the default desktop and instead I need a terminal to be in the place of the desktop. As an example if I’m using Windows my desktop looks as shown in below.

enter image description here

But, I don’t need to see the desktops icons & wallpaper, and what I need to see is the desktop as the screenshot shown in below. (Note: Here I have used Windows Terminal).

enter image description here

So, then when I right-click my taskbar and select Show the desktop or press Win + D shortcut, it should come to this Terminal Desktop instead of that ordinary desktop! Note that I still need to see the taskbar (I don’t need a complete DOS feeling :D).

How can I archive this?

I was thinking that,

May be stacking the items as this, will be a solution.

enter image description here

(Note that, this stacking should be persistent.)

How can I achieve this?


Get this bounty!!!

#StackBounty: #command-line #networking #ssh Meaning of SSH command with 2 IPs

Bounty: 50

Often I have seen ssh commands like:

ssh user1@user2@<one-ip-address>@<second-ip-address

First I thought this is to ssh through another server. But several questions and examples like How do I SSH to machine A via B in one command? gives better solutions for server through ssh.

So, my question is what kind of scenarios we have to use the above kind of ssh commands. What is the destination of the ssh command?


Get this bounty!!!

#StackBounty: #key-bindings #command-line #escape #map-operator #command Why does `<Bar>` behave like `|` in the `:command` comma…

Bounty: 50

Here is the list of experiments I performed that shows that <Bar> is treated as literal <Bar> in some commands but it is treated as | in the :command command.

I am trying to understand why or what in the documentation dictates that <Bar> should be treated as | in the :command command.

Case 1: :! and <Bar>

Enter this command-line mode command in Vim:

:!uname <Bar> grep i

We get this error:

/bin/bash: Bar: No such file or directory

This error occurred because the following shell command was invoked: uname < Bar > grep i and there is no file named Bar to redirect the standard input of uname to.

We see that the string <Bar> was literally sent to the shell.

Case 2: :echo and <Bar>

Enter this command-line mode command in Vim:

:echo 'hi' <Bar> echo 'bye'

We get this error:

E121: Undefined variable: Bar
E15: Invalid expression: 'hi' <Bar> echo 'bye'

Once again <Bar> was literally used as argument in the :echo command.

Case 3: :command, :! and <Bar>

Enter these command-line mode commands in Vim:

:command! A !uname <Bar> grep i
:A

I get this output:

Darwin

You may get Linux in your output.

The argument <Bar> was interpreted as |.

Case 4: :command, :echo and <Bar>

Enter these command-line mode commands in Vim:

:command! A echo 'hi' <Bar> echo 'bye'
:A

We get this output:

hi
bye
Press ENTER or type command to continue

Again, the argument <Bar> was interpreted as |.

Question

Why is <Bar> treated as 5-character literal argument in case of :!, :echo, etc. but it is treated as | in :command? I searched the documentation but I can’t seem to find anything.

The documentation does mention that <Bar> can be treated as | in the :map and some other commands, but it never mentions anything about it being treated as | in the :command command.

Here are some excerpts from the documentation that one can find by entering :helpgrep <Bar>:

  1. This talks about usage of <Bar> in the :map command. See :help :bar.
     There is one exception: When the 'b' flag is present in 'cpoptions', with the
     ":map" and ":abbr" commands and friends CTRL-V needs to be used instead of
     ''.  You can also use "<Bar>" instead.  See also |map_bar|.
    
  2. This talks about the usage of many keycodes including <Bar> in :map command and a few other commands but no mention of the :command command. See :help keycodes.
                                             *key-notation* *key-codes* *keycodes*
     These names for keys are used in the documentation.  They can also be used
     with the ":map" command (insert the key name by pressing CTRL-K and then the
     key you want the name for).
    
     ...
    
     <Bslash>        backslash                       92     *backslash* *<Bslash>*
     <Bar>           vertical bar            |       124     *<Bar>*
     <Del>           delete                          127
    
     ...
    
     For mapping, abbreviation and menu commands you can then copy-paste the
     examples and use them directly.  Or type them literally, including the '<' and
     '>' characters.  This does NOT work for other commands, like ":set" and
     ":autocmd"!
    
  3. This one also talks about usage of <Bar> in the :map command. See :help map-bar.
                                                         *map_bar* *map-bar*
     Since the '|' character is used to separate a map command from the next
     command, you will have to do something special to include  a '|' in {rhs}.
     There are three methods:
        use       works when                    example      ~
        <Bar>     '<' is not in 'cpoptions'     :map _l :!ls <Bar> more^M
        |        'b' is not in 'cpoptions'     :map _l :!ls | more^M
        ^V|       always, in Vim and Vi         :map _l :!ls ^V| more^M
    
     (here ^V stands for CTRL-V; to get one CTRL-V you have to type it twice; you
     cannot use the <> notation "<C-V>" here).
    
  4. Again, this talks about the :map command only. See :help usr_40.
     SPECIAL CHARACTERS
    
     The ":map" command can be followed by another command.  A | character
     separates the two commands.  This also means that a | character can't be used
     inside a map command.  To include one, use <Bar> (five characters).  Example:
     >
             :map <F8> :write <Bar> !checkin %:S<CR>
    

How can we explain the treatment of <Bar> as | in the :command command then?


Get this bounty!!!

#StackBounty: #ubuntu #command-line #ssh #x2go Git auth on EC2 works via command line within X2GO, but not by SSH

Bounty: 50

I work on multiple EC2 instances which each contain repos that need frequent updating. So I ssh to the EC2 instance, cd to the repo, and run git pull. Simple enough.

The problem is outlined in the diagram below. The git pull only works when I

  • from my laptop, log remotely into my workstation via X2G0
  • open a terminal window in the GUI
  • ssh into the EC2 from within the workstation

It does not work when I:

  • ssh directly to the EC2 from my laptop, even though I authenticate with the same key

It even does not work when I

  • from my laptop, ssh into my workstation
  • ssh into the EC2 from within the workstation

It is the last one that is a particular puzzler and has cost me some productive time when X2GO is not feasible. What settings could be different about opening a terminal window within the Ubuntu GUI, and then using ssh there, that are not present when I ssh to the same computer and am therefore on the command line already? All the same environment variables are present.
Diagram


Get this bounty!!!

#StackBounty: #magento2 #cli #command-line #command How to run php function directly after a specific Magento 2 CLI command?

Bounty: 50

For the sake of simplicity, let’s say I want to echo out "Hello World" (in reality i want to do a lot more) directly after anyone runs php bin/magento setup:di:compile. In the latest version of Magento what is the correct way to do this without going directly in to vendor folders and modifying files? Observers are on their way out, interceptors seem to be the way forward but I cannot get an interceptor to run when basing it on the classes that perform the setup:di:compile action. Anyone know how to do this?


Get this bounty!!!

#StackBounty: #command-line #google-chrome Open new Chrome window with different profile from command line

Bounty: 50

I want to run a command line that opens a new chrome window with another profile.

I tested the following commands:

Preconditions:

  • I have two profiles: Profile 1 and Profile 2
  • Chrome is already running with Profile 1

google-chrome --profile-directory="Profile 2"

The above command does nothing other than bringing focus to the currently running chrome with Profile 1

I also tried:

google-chrome --profile-directory="Profile 2" --new-window

The effect is the same.

I want to run a command line that opens a new chrome window with Profile 2 while there is already a Chrome window running with Profile 1


Get this bounty!!!

#StackBounty: #windows #command-line #video #ffmpeg How to copy unsupported data streams with ffmpeg?

Bounty: 50

Briefing

I have some .wmv files (actually, my full batch file deals with multiple filetypes) with weird data streams that are needed for an external program to recognize them.

I’m trying to remove every stream that is not data or audio, which also needs to be reencoded.

My current command is

fmpeg -y -loglevel debug -flags global_header -err_detect ignore_err -fflags +igndts -copy_unknown -i "%%~fV" -f !ext! -c copy -map 0 -vn -sn -b:a 32k "%%~pnxV.tmpoutput"

Which works for other file types with the same type of data stream and will work with .wmv if I add -dn (even though my file is then not recognizable by the external program). The command above, as is, for .wmv files will output the error Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted.

From FFprobe (full output below), I can see the message Unsupported codec with id 0 for input stream 2, so I believe it’s beyond doubt that the cause is indeed the data stream.


Question

The thing is that I expected -copy_unknown to deal with this and it doesn’t. My question is: how do I copy this unsupported, not used anywhere else data stream? Are there other ways to approach the matter?

Thanks


Extra info

Full FFmpeg output (with -loglevel debug):

ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-flags' ... matched as AVOption 'flags' with argument 'global_header'.
Reading option '-err_detect' ...Routing option err_detect to both codec and muxer layer
 matched as AVOption 'err_detect' with argument 'ignore_err'.
Reading option '-fflags' ... matched as AVOption 'fflags' with argument '+igndts'.
Reading option '-copy_unknown' ... matched as option 'copy_unknown' (Copy unknown stream types) with argument '1'.
Reading option '-i' ... matched as input url with argument 'C:UsersFabioDesktopTestestesta.wmv'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'asf'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0'.
Reading option '-vn' ... matched as option 'vn' (disable video) with argument '1'.
Reading option '-sn' ... matched as option 'sn' (disable subtitle) with argument '1'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '32k'.
Reading option 'UsersFabioDesktopTestestesta.wmv.tmpoutput' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Applying option copy_unknown (Copy unknown stream types) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url C:UsersFabioDesktopTestestesta.wmv.
Successfully parsed a group of options.
Opening an input file: C:UsersFabioDesktopTestestesta.wmv.
[NULL @ 0000025955e7af40] Opening 'C:UsersFabioDesktopTestestesta.wmv' for reading
[file @ 0000025955e7b740] Setting default whitelist 'file,crypto'
[asf @ 0000025955e7af40] Format asf probed with size=2048 and score=100
[asf @ 0000025955e7af40] gpos mismatch our pos=24, end=244
[asf @ 0000025955e7af40] gpos mismatch our pos=24, end=26
[asf @ 0000025955e7af40] gpos mismatch our pos=24, end=3295
[asf @ 0000025955e7af40] Payload extension 50 2
[asf @ 0000025955e7af40] gpos mismatch our pos=24, end=42
[asf @ 0000025955e7af40] gpos mismatch our pos=24, end=44
[asf @ 0000025955e7af40] gpos mismatch our pos=24, end=834
[asf @ 0000025955e7af40] Before avformat_find_stream_info() pos: 5793 bytes read:32768 seeks:0 nb_streams:3
[asf @ 0000025955e7af40] parser not found for codec wmav2, packets or times may be invalid.
[wmv3 @ 0000025955eb4480] Header: 46690A01
[wmv3 @ 0000025955eb4480] Profile 1:
frmrtq_postproc=3, bitrtq_postproc=6
LoopFilter=1, MultiRes=0, FastUVMC=0, Extended MV=0
Rangered=0, VSTransform=1, Overlap=1, SyncMarker=0
DQuant=0, Quantizer mode=0, Max B-frames=0
[wmv3 @ 0000025955eb4480] Extra data: 8 bits left, value: 0
[wmv3 @ 0000025955eb4480] Format yuv420p chosen by get_format().
    Last message repeated 1 times
[asf @ 0000025955e7af40] parser not found for codec wmav2, packets or times may be invalid.
[asf @ 0000025955e7af40] All info found
[asf @ 0000025955e7af40] After avformat_find_stream_info() pos: 191671 bytes read:196608 seeks:0 frames:58
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, asf, from 'C:UsersFabioDesktopTestestesta.wmv':
  Metadata:
    copyright       : ChessBase GmbH
    WMFSDKVersion   : 12.0.9600.17415
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 0
    DeviceConformanceTemplate: MP@ML
  Duration: 00:00:23.08, start: 0.000000, bitrate: 526 kb/s
    Stream #0:0, 17, 1/1000: Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, stereo, fltp, 96 kb/s
    Stream #0:1, 41, 1/1000: Video: wmv3 (Main), 1 reference frame (WMV3 / 0x33564D57), yuv420p(left), 640x480, 0/1, 415 kb/s, 25 tbr, 1k tbn, 1k tbc
    Stream #0:2, 0, 1/1000: Data: none, 0/1, 10 kb/s
Successfully opened the file.
Parsing a group of options: output url UsersFabioDesktopTestestesta.wmv.tmpoutput.
Applying option f (force format) with argument asf.
Applying option c (codec name) with argument copy.
Applying option map (set input stream mapping) with argument 0.
Applying option vn (disable video) with argument 1.
Applying option sn (disable subtitle) with argument 1.
Applying option b:a (video bitrate (please use -b:v)) with argument 32k.
Successfully parsed a group of options.
Opening an output file: UsersFabioDesktopTestestesta.wmv.tmpoutput.
[file @ 0000025955eee200] Setting default whitelist 'file,crypto'
Successfully opened the file.
Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
    Last message repeated 1 times
[AVIOContext @ 0000025955eee2c0] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0000025955e83980] Statistics: 196608 bytes read, 0 seeks

FFprobe on a sample file:

ffprobe version 4.3 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200621
  configuration: --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libaom --enable-libgsm --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-libopenmpt --enable-amf
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
[wmv3 @ 00000180012e1440] Extra data: 8 bits left, value: 0
Input #0, asf, from 'test/a.wmv':
  Metadata:

    WMFSDKVersion   : 12.0.9600.17415
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 0
    DeviceConformanceTemplate: MP@ML
  Duration: 00:00:23.08, start: 0.000000, bitrate: 526 kb/s
    Stream #0:0: Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, 2 channels, fltp, 96 kb/s
    Stream #0:1: Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 640x480, 415 kb/s, 25 tbr, 1k tbn, 1k tbc
    Stream #0:2: Data: none, 10 kb/s
[wmv3 @ 0000018001324a80] Extra data: 8 bits left, value: 0
Unsupported codec with id 0 for input stream 2

Other

I chose to specify -f and .tmpoutput to facilitate other non-related parts of my flow.


Get this bounty!!!

#StackBounty: #command-line #gnome #nautilus #gvfs #google-drive How to access Google drive using Gnome Online Accounts (GOA) in comman…

Bounty: 50

Before anything, this is not (as far as I could search) a duplicate.

I enabled GOA for my Google account and enabled Files, so my account showed up in Nautilus under my computer just fine. To my surprise I also have Thunar file manager and it showed up there too. Great!

Now I was wondering if I could access it using the terminal, or Terminator or whatever terminal emulator I have installed. Following some recommendations I found online, since this is a Gnome Virtual File System (GVFS) I listed the contents of my gvfs location like below:

ls "$XDG_RUNTIME_DIR"/gvfs/google-drive:host=gmail.com,user=username

And it showed (apparently) my files and folders but in a somewhat decoded format, like below:

ls "$XDG_RUNTIME_DIR"/gvfs/google-drive:host=gmail.com,user=username
0B2f4njx3e-blablalba    0B2f4njx3e-blablalbe
0B2f4njx3e-blablalbi    0B2f4njx3e-blablalbo

So, I thought the native gvfs tools could, maybe decode that on the fly, so I tried the below which showed a similar output:

$ gvfs-ls google-drive://username@gmail.com/
0B2f4njx3e-blablalba
0B2f4njx3e-blablalbe
0B2f4njx3e-blablalbi
0B2f4njx3e-blablalbo

Well, has anyone seen that before? And could anyone make it work?

I know there is a FUSE-like driver by some enthusiast that apparently works and I will totally try it if this native one doesn’t work, but I wanted to be able to be sure there is no way to make it work with native software.


Get this bounty!!!

#StackBounty: #command-line #windows-10 #user-accounts How to initialize new user account from command line

Bounty: 50

I would like to initialize new user account on Windows 10 without login out from admin and login in again to user. Now I create new account with following command:

net user “username” “password” /add

Next I run some program with command that should load user profile:

C:> runas /profile /user:user program.exe

However it is not equivalent to the logging as this user. Environment and some folders structures are not prepared without actual logging in. Is there any way to do this?


Get this bounty!!!