In Windows 10, I am using qrencode for printing QR codes to image files. The printing is successful but I am stuck at adding line breaks. I have tried the below method with no success in line breaks.
Windows Command Prompt:
d:\ qrencode -o qrcode.png "INDO GERMAN ALKALOIDS \nUnique ID: ABC-123456789 \nAPI-Name: ABCDEFGH \nBrand: Indo-101 \nAddress: Inga House, Mahakali Road, Andheri-East, Mumbai-400093, \nTel-022-28202932/33, \nMobile: 9833942075, \nBatch No.: XYZ888999000, \nBatch Size: 1020, \nMfgd.Date: 29-12-2022, \nExpiry Date: 31-12-2023, \nContainer Code: RRR-101020, \nMfgr Lic.No.: ------------, \nStorage Instruction: Store in cool area 20deg"
After playing around for some time, I came across the below command in the Ubuntu Manuals:
cat bigfile.txt | qrencode -S -v 40 -l L -o output.png
I placed the required content as below in a text file named qr-data.txt
INDO GERMAN ALKALOIDS
Unique ID: ABC-123456789
API-Name: ABCDEFGH
Brand: Indo-101
Then at the DOS prompt I typed:
type qr-data.txt | qrencode -o qr-code.png
It now works perfect for me.
Note that I used [type] instead of [cat] in MS DOS.
Related
So I have raw image and I am just curious If I can edit such image to save as RGB-32 Packed transparent interlaced raw and what program I could use, there is specification:
Format of RAW image
I have tried using photoshop but then game crashes. Is it even possible? I should get file without thumbnail. I also tried using gimp, free converters and Raw viewer but no luck. Any suggestions?
Edit:
Used photoshop (interleaved with transparency format), game starts but images are just bunch of pixels.
file that i try to prepare (221bits)
We are still not getting a handle on what output format you are really trying to achieve. Let's try generating a file from scratch, to see if we can get there.
So, let's just use simple commands that are available on a Mac and generate some test images from first principles. Start with exactly the same ghost.raw image you shared in your question. We will take the first 12 bytes as the header, and then generate a file full of red pixels and see if that works:
# Grab first 12 bytes from "ghost.raw" and start a new file "red.raw"
head -c 12 ghost.raw > red.raw
# Now generate 512x108 pixels, where red=ff, green=00, blue=01, alpha=fe and append to "red.raw"
perl -E 'say "ff0001fe" x (512*108)' | xxd -r -p >> red.raw
So you can try using red.raw in place of ghost.raw and tell me what happens.
Now try generating a blue file just the same:
# Grab first 12 bytes from "ghost.raw" and start a new file "blue.raw"
head -c 12 ghost.raw > blue.raw
# Now generate 512x108 pixels, where red=00, green=01, blue=ff, alpha=fe and append to "blue.raw"
perl -E 'say "0001fffe" x (512*108)' | xxd -r -p >> blue.raw
And then try blue.raw.
Original Answer
AFAIK, your image is actually 512 pixels wide by 108 pixels tall in RGBA8888 format with a 12-byte header at the start - making 12 + 4*(512 * 108) bytes.
You can convert it to PNG or JPEG with ImageMagick like this:
magick -size 512x108+12 -depth 8 RGBA:ghost.raw result.png
I still don't understand from your question or comments what format you actually want - so if you clarify that, I am hopeful we can get you answered.
Try using online converters. They help most of the time.\
A Website like these can possibly help:
https://www.freeconvert.com/raw-to-png
https://cloudconvert.com/raw-to-png
https://www.zamzar.com/convert/raw-to-png/
Some are specific websites which ask you for detail and some are straight forward conversions.
I was running a program, and it will output the progress bar. I did it like this
python train.py |& tee train.log
The train.log looks like the following.
This is line 1
Training ...
This is line 2
...
[000] valid: 100%|█████████████████████████████████████████████████████████████▉| 2630/2631 [15:24<00:00, 2.98 track/s]
[000] valid: 100%|██████████████████████████████████████████████████████████████| 2631/2631 [15:25<00:00, 3.02 track/s]
Epoch 000: train=0.11940351 valid=0.10640465 best=0.1064 duration=0.79 days
This is line 3
...
[001] valid: 100%|█████████████████████████████████████████████████████████████▉| 2629/2631 [15:11<00:00, 2.90
[001] valid: 100%|█████████████████████████████████████████████████████████████▉| 2630/2631 [15:11<00:00, 2.89
[001] valid: 100%|██████████████████████████████████████████████████████████████| 2631/2631 [15:12<00:00, 2.88
Epoch 001: train=0.10971066 valid=0.09931737 best=0.0993 duration=0.79 days
On the terminal, they are supposed to be viewed as replacing itself, hence in the log file, there are alot of repetitions. So when I did wc -l train.log, it only returned 3 lines. However when I opened this 5MB text file in the text editor, there are like 20000 lines.
My objective is to only get these details:
Epoch 000: train=0.11940351 valid=0.10640465 best=0.1064 duration=0.79 days
Epoch 001: train=0.10971066 valid=0.09931737 best=0.0993 duration=0.79 days
My questions are:
How do I, without stopping my current training progress, extract my desired details from the suppposedly "3" lines of train.log? Keep in mind that this training will be continuously done for 10 more epochs, so I don't want to open the whole junk of progress bar in the editor.
In the future, how should I store my log file (instead of calling python train.py |& tee train.log) such that while I can see the progress bar in the terminal, I only keep the important information in a text file?
Edit 1 :
Here's a link to the file train.log
The progress bars are probably written to stderr, which you send to tee together with stdout by using |&.
To write only stdout to the file, use the normal pipe | instead.
The progress bar was generated by writing one line and then a carriage return character (\r) but no newline character (\n). To fix that and to be able to process the file further, you can use for example sed 's/\r/\n/g'.
The following works with the file linked in the question:
$ sed 's/\r/\n/g' train.log | grep Epoch
Epoch 000: train=0.11940351 valid=0.10640465 best=0.1064 duration=0.79 days
Ok, I solved it already.
According to this question,
You make a progress bar by doing echo -ne "your text \r" > log.file.
So because some editor that i used (Notepad, sublime text 3) recognise \r as a line breaker, you see them as seperate line, but in actual fact they are stored in single line.
So to reverse engineer it, you can make them into actual line breakers sed -i "s,\r,\n,g" train.log, and the grep accoringly.
Anyhoo, thanks #mkrieger1 for helping me out anyway !
I switched from Windows cmd terminal to bash in PhpStorm and now when I run Symfony CLI commands like server:start it shows characters like ?[30;43m instead of a formatted text.
I tried these Symfony commands on both PhpStorm and Visual studio code with the same results. It did work on git bash terminal though.
Here a screenshot from PhpStorm executing server:start:
and a screenshot using Windows cmd for the same command:
Do you know how to solve this problem?
My solution
I left Windows to Linux. Now everything works fine. I could not make it work properly on Windows though.
I think the ? means that my terminal on windows had trouble with the escape character used to interpret the formatting code [30;43m.
Here is my homemade explanation of this kind of formatting code:
Use echo -e to use text formatting.
Syntaxe:
\e[FORMAT;FORMAT;FORMATm
\e is the escape character (\033 works too).
[ mark the beginning of the format code.
; separate formating code sequence.
m mark the end of the format code.
FORMAT has to be replaced by a formatting code:
character effects using 1 digit:
code | effect
---- | ------
0 | normal
1 | bold
4 | underlined
5 | blinking
7 | reverse colors
colors using 2 digit:
first digit (the target):
code | effect
---- | ------
3 | foreground
4 | background
second digit (the color):
code | effect
---- | ------
0 | black
1 | red
2 | green
3 | brown
4 | blue
5 | purple
6 | cyan
7 | light gray
These are color codes, from the ANSI Escape codes : https://en.wikipedia.org/wiki/ANSI_escape_code
Some terminals use these codes to apply text formatting, while others just display them as regular text. Most programs that print such codes in an attempt to color their output also have an option to silence them, in order to make the display more readable on dumber terminals.
Is there a way through command line to know what keyboard physical layout a macbook has? I cannot find that specific information in system_profiler. I want to know if the computer has a US, UK, ES, etc keyboard layout.
The aim is to script it, upload it to my MDM so I can run it in all the company's laptops and find out that information.
Thanks!
running the terminal command system_profiler SPSPIDataType
it shows this:
SPI:
Apple Internal Keyboard / Trackpad:
Product ID: 0x0278
Vendor ID: 0x05ac (Apple Inc.)
ST Version: 8.96
MT Version: 4.69
Serial Number: FM7741701QVGN41A5+RNZ
Manufacturer: Apple Inc.
Location ID: 0x01000000
I run it in two different macbooks, one UK, one ES. I was hoping that the Location ID would show something different but that was not the case.
If I do this in Terminal:
defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources | egrep -w 'KeyboardLayout Name'
I get this:
"KeyboardLayout Name" = *name of my keyboard in readable form*
I think I just found the solution, like this:
ioreg -l | grep KeyboardLanguage | awk '{print substr( $0, 56, 20)}' | tr -d "\" =|"
Thanks,
Federico.
I want to install elasticsearch5.6.4 on ubuntu 17.10. So I downloaded elasticsearch.deb and elasticsearch.deb.sha1. As the sturcture said in this guide, after I run
shasum -a 512 -c elasticsearch-6.2.1.tar.gz.sha512
I have gotten this error:
shasum: elasticsearch-5.6.4.deb.sha1: no properly formatted SHA1 checksum lines found
What does this error mean? and what should I do?
You are correct and I'm a bit puzzled (since I've written that section in the Elastic docs): shasum -a 512 works on other operating systems and checking the man page, I would have thought it should do the same on Ubuntu:
-a, --algorithm 1 (default), 224, 256, 384, 512, 512224, 512256
When verifying SHA-512/224 or SHA-512/256 checksums, indicate the
algorithm explicitly using the -a option, e.g.
shasum -a 512224 -c checksumfile
I'm not sure why shasum -a 512 doesn't work here, but these 3 alternatives all give you the correct result:
shasum -c elasticsearch-6.2.1.deb.sha512 -a 512
shasum -a 512256 -c elasticsearch-6.2.1.deb.sha512
sha512sum -c elasticsearch-6.2.1.deb.sha512
This answer is not so much for the OP (who is hopefully sorted now) but any passers by who encounter the error in the question.
The error
shasum: [CHECKSUM_FILENAME] : no properly formatted SHA[TYPE] checksum lines found
indicates that the checksum file passed to the -c flag is not formatted as
follows
a67eb6eeeff63ac77d34c2c86b0a3fa97f69a9d3f8c9d34c20036fa79cb4214d ./kbld-linux-amd64
Where
the first field is the expected checksum,
the second field is a ' ' character indicating that the file is to be checked as a text file (as opposed to being checked as a binary file or being checking in Universal mode which ignores newlines)
and the third field is the name of the file you likely just downloaded and whose integrity you want to verify
So in the example above the developers who created kbld supplied the above text on their release page to show the checksums that they calculated after they built the kbld binaries for various platforms.
I added the line for the linux build to a file called kbld_v0_7_0.checksum and then I ran the following in the directory where I downloaded the kbld-linux-amd64 binary
$ shasum -c kbld_v0_7_0.checksum -a 256
./kbld-linux-amd64: OK
The OK from shasum shows that the binary that I downloaded, ./kbld-linux-amd64 , generates the same sha256 checksum that was produced when the developers did their build which indicates that the files are, in all likelihood, identical