Why is the message of the shutdown pop-up cut off? - windows

I am working on a prank Program that randomly reboots your pc while also doing other stuff.
Anyways, I am currently working on the reboot part and I came up with this command:
shutdown -g -t 30 -d p:2:18 -c "Dieser Computer wurde von einer externen Quelle übernommen und wird momentan infiziert mit dem WannaCry Virus. Um nicht-autorisierten Zugriff auf anderen Computern in diesem Netzwerk zu vermeiden starten wir nun Ihr Gerät neu." -f
My Problem is that the text is being cut off because of no particular reason. This is what the pop-up looks like:
The Pop-Up
I did some research on why this could happen, but I see no reason.
/c "comment": This command option allows you to leave a comment describing the reason for the shutdown or restart. You must include quotes around the comment. The maximum length of the comment is 512 characters.
Source: https://www.lifewire.com/shutdown-command-2618100
Does anyone know why this could happen?
Thanks in advance
TRG

Interesting, I can reproduce using an even shorter message like "nicht-auto" or "n-a". Perhaps it interprets "-a" like a new parameter, despite being quoted. If you remove the dash "-", it works. Looks like a bug to me.
A workaround is to replace the dash by an alternative Unicode character:
shutdown -g -t 30 -d p:2:18 -c "nicht$([char]0x2010)autorisierten" -f

Related

Youtube-dl -o format: can I use conditions

I see so many questions on youtube-dl's -f flag. I want to know about the -o flag. I basically want to do:
-o '%(artist ? artist : "Unknown Artist")s/%(album ? album : "Unknown Album")s/%(track ? track : title)s.%(ext)s'
or if you come from some languages, this might make more sense:
-o '%(artist ?? "Unknown Artist")s/%(album ?? "Unknown Album")s/%(track ?? title)s.%(ext)s'
So how can I do this? The goal is to avoid youtube-dl from making default folders like NA, or to use a more appropriate field when applicable, or even pass in shell args to use as defaults when the tags don't exist.
EDIT
Since it was requested, here is what prompted this:
I am trying to download this playlist. Let's look at these two videos in particular:
https://youtu.be/1HTjrjjmBPU
https://youtu.be/6nllogf68FE
When I run
youtube-dl -o '%(artist)s/%(album)s/%(track)s.%(ext)s' <url>
the resulting output directories are
The Oh Hellos/Dear Wormwood/Prelude.f137.mp4
NA/NA/NA.f137.mp4
The first one is completely acceptable, but the second one is obviously not. I would like to be able to apply a conditional formatting so that the output of the first command stays the same, and the second command outputs either
The Oh Hellos/Dear Wormwood/Exeunt.f137.mp4
or
Unknown Artist/Unknown Album/The Oh Hellos - Exeunt.f137.mp4
You have three options.
Use --output-na-placeholder Unknown to make Unknown directories instead of NA directories.
Create symbolic links for NA to Unknown Artist/Unknown Album:
mkdir "Unknown Artist"; ln -s "Unknown Artist" NA; cd "Unknown Artist"; mkdir "Unknown Album"; ln -s "Unknown Album" NA
Use yt-dlp for defaults:
yt-dlp -o '%(artist|Unknown Artist)s/%(album|Unknown Album)s/%(track|Unknown Track)s.%(ext)s' <url>
Tested: [download] Destination: Unknown Artist/Unknown Album/Unknown Track.mp4

'C:\Program' is not recognized as an internal or external command in 'Git Bash Here' terminal - Windows (salesforce sfdx) - SOLVE

I'm here to ask you a very strange problem.
Right now i'm starting to work on Salesforce technology, in windows, and currently i follow the tutorial. When finally arrive to the terminal part, Windows come out to create problem...
I state that I am using the terminal of Git Bash Here (MinTTY)
$ sfdx force:data:record:create -s Account -v "Name='Hilton Union Square' BillingStreet='333 O Farrell St' BillingCity='San Francisco' BillingState='CA' BillingPostalCode='94102' Phone='(415) 771-1400' Website='www.hilton.com'"
"C:\Program" non è riconosciuto come comando interno o esterno,
un programma eseguibile o un file batch.
More in general, the problem comes out every time there are Quote in the argument:
$ sfdx ""
"C:\Program" non è riconosciuto come comando interno o esterno,
un programma eseguibile o un file batch.
opposite to:
$ sfdx
Salesforce CLI
VERSION
sfdx-cli/7.157.0 win32-x64 node-v16.15.1
USAGE
$ sfdx [COMMAND]
TOPICS
alias manage username aliases
auth authorize an org for use with the Salesforce CLI
config configure the Salesforce CLI
......
I try almost every thing: alias, Path, Full Path, Short Path, Quote, ...
this is my current path:
PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/A409806/bin:/c/Program Files/Common Files/Oracle/Java/javapath:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files (x86)/WindowsPowerShell/Scripts:/cmd:/c/Program Files/nodejs:/c/Users/A409806/AppData/Local/Microsoft/WindowsApps:/c/Program Files/sfdx/bin:/c/Users/A409806/AppData/Roaming/npm:/c/Users/A409806/AppData/Local/Programs/Microsoft VS Code/bin:/c/Users/A409806/AppData/Local/JetBrains/Toolbox/scripts:/usr/bin/vendor_perl:/usr/bin/core_perl
Please, someone help me, i suppose is MinTTY problem, but i can't immage how solve it.
Thanks agane
UPDATE
I expose same problem and find de solution here:
Solution

Getting the first paragraph of Wikipedia, and storing it into a text file

I wanted to make a system in which we give something to be search onto the terminal of a Raspberry Pi and the Pi gives a voice output.
I've solved the text-to-speech conversion problem using pico TTS. Now what I wanted to do is go to the Wikipedia page of the term to be searched, and store the first paragraph of the page to a text file.
For example, the result for input Tiger in Simple English should make a text file containing -
The tiger (Panthera tigris) is a carnivorous mammal. It is the largest living member of the cat family, the Felidae. It lives in Asia, mainly India, Bhutan, China and Siberia.
I tried using this but it didn't seem to work.
Error message for
$ pip install wikipedia
...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-qdTIZY/wikipedia/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-9CPD6D-record/install-record.txt --single-version-externally-managed --compile
failed with error code 1 in /tmp/pip-build-qdTIZY/wikipedia
Storing debug log for failure in /home/pi/.pip/pip.log
this seems to work:
title=Tiger
n_sentences=2
curl -s http://simple.wikipedia.org/w/api.php?action=query&prop=extracts&titles="$title"&exsentences="$n_sentences"&explaintext=&format=json |
sed 's/.*"extract":"\|"}}}}$//g'
it correctly yields:
The tiger (Panthera tigris) is a carnivorous mammal. It is the largest living member of the cat family, the Felidae.
Also tested with title=Albert_Einstein:
Albert Einstein (14 March 1879 \u2013 18 April 1955) was a German-born theoretical physicist who developed the general theory of relativity, one of the two pillars of modern physics (alongside quantum mechanics).\nHe received the Nobel Prize in Physics in 1921, but not for relativity.
(Note that title="Albert Einstein", title=albert_einstein, and title=albert%20einstein all don't work, so you'll eventually want another command to find the best matching real simple.wikipedia article title.)
the curl command makes an http request to simple.wikipedia.org. to see this in action, try this:
curl http://simple.wikipedia.org/w/api.php?action=query&prop=extracts&titles=Tiger&exsentences=2&explaintext=&format=json
the sed command then extracts the desired part of the response.
updated to increase chance of working with raspberry's curl & sed: changed https to http and rewrote sed command without -e.
ref:
MediaWiki API?

OS X Yosemite - Adding a Printer - UI Vs lpadmin

My problem is that when I add a printer using the Printers and Scanners UI printing works, when I add the same printer using lpadmin it doesn't.
To Add it through the UI I did the following:
From Printers and Scanners I selected the IP tab.
Address: 10.20.30.40, Protocol HP Jetdirect - Socket, Queue left blank, Name: TEST_01, Location "Top Floor", Use -> Select software -> HP LaserJet P3010 Series
After doing this, the Printer works as expected.
This is a (segment from a) script containing my lpadmin command that doesn't work
SUBNET=socket://10.20.30.
TEST_01=40
PPD_DIR=/Library/Printers/PPDs/Contents/Resources
TEST_01_PPD="hp LaserJet P3010 Series.gz"
lpadmin -E -p TEST_01 -v $SUBNET$TEST_01 -P "$PPD_DIR/$TEST_01_PPD" -D "TEST_01" -L "Top Floor"
The printer appears correctly in the UI but shows as paused.
I did find a message in system.log that may or may not be relevant - I was using Notes to test the printer:
Notes[502]: Failed to connect (_delegate) outlet from (com_hp_psdriver_19_11_0_PDEView) to (com_hp_psdriver_19_11_0_PDEAccountingController): missing setter or instance variable
Notes[2198]: Printing failed because PMSessionEndDocumentNoDialog() returned -30871.
The reason I want to use a script is that there are 20 printers to add on each of 30 new Macs. The actual script uses a series of arrays with lpadmin in a for loop. Everything I have read says it should work. What am I missing?
I think -E specified before the printer name enables encryption, whereas specified after it Enables the printer - effectively "unpausing" it. Madness- I know!
Mad Apple Documentation - see second sentence
I think you want:
lpadmin -p TEST_01 -v $SUBNET$TEST_01 -P "$PPD_DIR/$TEST_01_PPD" -D "TEST_01" -L "Top Floor" -E
I don't have a direct answer, but I can suggest an alternate approach: set up all 20 printers by hand on one computer, then copy the /etc/cups directory from that one to the other 29.

Dissappearing characters in youtube-dl, ffmpeg, and windows

so what happens is that if the video title has a symbol that isn't supported by your current locale then ffmpeg won't be able to get to that file properly.
Here's one example
►2 HOURS BEST MELODIC DUBSTEP MIX APRIL 2013◄ ヽ( ≧ω≦)ノ
as you may or may not be able to see, lots of symbols from unicode.
The problem is that in cmd and ffmpeg, though cmd can see
►2 HOURS BEST MELODIC DUBSTEP MIX APRIL 2013◄ ヽ( ≧ω≦)ノ
ffmpeg only sees
2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013 ヽ(≧ω≦)ノ
This is the exact error message (i'm using youtube-dl)
[ffmpeg] Adding metadata to 'C:\Music\ToBeDone\2014-06-01\►2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013◄ ヽ( ≧ω≦)ノ.mp4'
ERROR: C:\Music\ToBeDone\2014-06-01\2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013 ヽ(≧ω≦)ノ.mp4: No such file or directory
ERROR: WARNING: unable to obtain file audio codec with ffprobe
After some research i've determined that by changing the system locale you can change which symbols cmd can support.
However
ヽ
Used to appear as a box in a question mark in United states locale. In japanese locale it appears as it does on your screen right now.
the problem with
◄
is that even though it's not appearing as a question mark in a box (it's appearing as how it should be), ffmpeg (or cmd) can't detect it properly.
(Refer back to the error message, i'll repost it below.)
[ffmpeg] Adding metadata to 'C:\Music\ToBeDone\2014-06-01\►2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013◄ ヽ( ≧ω≦)ノ.mp4'
ERROR: C:\Music\ToBeDone\2014-06-01\2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013 ヽ(≧ω≦)ノ.mp4: No such file or directory
ERROR: WARNING: unable to obtain file audio codec with ffprobe
So as you can see, I think cmd passed on the symbol correctly to ffmpeg seeing from the adding metadata line, but when it actually does the operation ffmpeg loses
► and ◄
Could this be a bug with ffmpeg? MY workaround so far with incompatible symbols was to change the system locale, but I don't think i can do that with these two symbols...
These are the unique characters that i need to have a locale that supports
Ö
◄ ヽ( ≧ω≦)ノ
( ͡° ͜ʖ ͡°)
(_≧∇≦)
†
【
More info on the problem in general
https://github.com/rg3/youtube-dl/issues/2999
and this is what's going on (Batch Script)
#echo off
setlocal
cd C:\youtube-dl
set /p "var1=Enter URL: " %=% pause
if defined var1 set "var1=%var1:"=%"
set "var2=%date:/=-%"
set "var3=%%(title)s.%%(ext)s"
youtube-dl "%var1%" -ci -o "C:\Music\ToBeDone\%var2%\%var3%" -f best -x --no-mtime --add-metadata
youtube-dl "%var1%" --skip-download -ci -o "C:\Music\ToBeDone\%var2%\Thumbnail\%var3%" --write- thumbnail
youtube-dl "%var1%" --skip-download -ci -o "C:\Music\ToBeDone\%var2%\Description\%var3%" --write-description

Resources