How to change signature of PNG file to "uncorrupt?" - png

So I have a corrupted PNG file (that I don't want to convert to JPG, etc. It has to be basically the same.) and I checked its first eight bytes (signature):
8950 4e47 0d0a b0aa
The actual signature for a PNG file is:
8950 4e47 0d0a 1a0a
How can I change the signature of my corrupted file?

Using hexedit you can manipulate your files. For that simply follow these steps:
Install hexedit
Open your file in hexedit
Move the cursor over a byte (here you have to move over the corrupted byte)
Enter what you would like to change the byte
Save the file
Update
To install hexedit run following command on terminal:
sudo apt-get install hexedit
For more info take a look at this blog post.

Related

Coq: Issue with Require Export

my issue seems to be a common one, but none of the found answers could solve it.
I am following the software foundations course on Coq, and so I come to the command:
> From LF Require Export Basics.
Whatever I try, I get always the following answer:
"Cannot find a physical path bound to logical path matching suffix <>
and prefix LF."
I compiled Basics.v from coqIde, and the Basics.vo file is created correctly.
I also compiled it from the coqc command line, as suggested somewhere
My _CoqProject file exists, in the same folder as Basics.v, and states: -Q . LF
the _CoqProject parameter is set to "appended to arguments".
when I load Basics.v I see on the bottom of CoqIde "Reading Options from ..._CoqProject"
I put the lf folder into a folder which is in the LoadPath of coq.
What else could I check?
My system is Windows 10. I run CoqIde 8.9.1
Thank you!
I usually work under a Linux machine, but here something I did using a virtual machine.
I downloaded the windows installer from https://github.com/coq/coq/releases/tag/V8.9.1
I downladed the lf.tgz file from https://softwarefoundations.cis.upenn.edu/lf-current/index.html
I ran the windows installer for Coq. It placed the coq system in C:\coq
I used cygwin tools to expand the file lf.tgz so that I had a directory C:\Users\user\foundations\lf containing Basics.v, _CoqProject etc.
Then I used the search command to find coqide as an installed app. I then proceeded with the following steps:
start coqide
open the file Basics.v
use the option Compile->Compile buffer
I could then observe that the directory C:\Users\user\foundations\lf contained a file named Basics.vo
Then I opened a new buffer, and wrote From LF Require Export Basics. and did not try to execute this line
I saved this buffer in a file in directory C:\Users\user\foundations\lf. Let's assume this file is named toto.v
I closed the toto.v buffer.
I re-opened the toto.v using the option File->Open
I executed the file contents.
This process is the result of trial-and-error. What I know is that Require Export ... only works if there are ...vo files on you disk, but coqide needs to know where to look for these files. For this it maintains a "load path". When opening a file from a given directory, coqide looks in this directory (and ancestors) to find a _CoqProject file, and the latter may contain directives to modify the load path. It is the case here "-Q . LF" indicates that all .vo files in the current directory should be considered, and that their symbolic name should start with the prefix "LF."
The problem is that when you start from an empty buffer, no _CoqProject file gets read and coqide does not where to look for your data. This is why I did the steps 5-6-7: when reading the file toto.v, I provoked the reading of the _CoqProject file.
Takeaway lesson: Make sure the Basics.vo file exists, and then make sure the buffer you are working on was obtained through a reading operation from the same directory. If needed, save, close, and re-open to make sure this is the case.

how to add binary file to buildroot generated image?

How can i include a pre-built binary file into buildroot generated image?
I have tried to include the binary file into appropriate folder in build_dir but every time i try to do make the image is being created without the file.
You can use a root filesystem overlay.
See chapter Project-specific customization in the Buildroot manual.
Just in case someone is looking for a easy fix you can add the files to buildroot-dir/files folder. The file should match the exact directory structure. For example you want to put the file in /usr/bin in the image then keep the file in buildroot-dir/files/usr/bin and rebuild the image.

Has anybody ever successfully downloaded the Cities project in netlogo

As shown in the following link, the developer says that the whole project codes are included in the zip archive, but after I downloaded and decompressed it, I can't find the file of Cities.nlogo which is the main procedure for the entire simulation project. I don't know if there are someone else encounter the same problem as mine, how do you solve it ?
http://ccl.northwestern.edu/cities/citiesmodel.shtml#download
I tried this just now:
% curl -OsS 'http://ccl.northwestern.edu/cities/cities.zip'
% unzip -l cities.zip | grep Cities.nlogo
error [cities.zip]: missing 2 bytes in zipfile
(attempting to process anyway)
36365 09-26-07 15:21 cities/Cities.nlogo
as you can see there is definitely a Cities.nlogo file in there, but is also appears that the zip file is slightly corrupted ("missing 2 bytes in zipfile"). You might try extracting the archive with a different program? It extracted successfully for me using Archive Utility on Mac OS X.

wget download and rename files that originally have no file extension

Have a wget download I'm trying to perform.
It downloads several thousand files, unless I start to restrict the file type (junk files etc). In theory restricting the file type is fine.
However there are lots of files that wget downloads without a file extension, that when manually opened with Adobe for example, are actually PDF's. These are actually the files I want.
Restricting the wget to filetype PDF does not download these files.
So far my syntax is wget -r --no-parent A.pdf www.websitehere.com
Using wget -r --no-parent www.websitehere.com brings me every file type, so in theory I have everything. But this means I have 1000's of junk files to remove, and then several hundred of the useful files of unknown file type to rename.
Any ideas on how to wget and save the files with the appropriate file extension?
Alternatively, a way restrict the wget to only files without a file extension, and then a separate batch method to determine the file type and rename appropriately?
Manually testing every file to determine the appropriate application will take a lot of time.
Appreciate any help!
wget has an --adjust-extension option, which will add the correct extensions to HTML and CSS files. Other files (like PDFs) may not work, though. See the complete documentation here.

How to move a file in to zip uncompressed, with zip cmd tool

I'm try to determine how to use the zip cmd line tool to move a file (uncompressed) in to a zip of compressed files (ie I want a zip in the end with all files but one compressed, b/c the one file is another compressed file).
Anyone know how to do this?
It looks like you could use -n option to just store the files with defined extensions together with -g option to append the file to archive.
I didn't test it, but something like this should do the trick:
zip -gn .foo archive.zip myAddedFile.foo
Although documentation states that, by default, zip does not compress files with extensions in the list .Z:.zip:.zoo:.arc:.lzh:.arj, so if you are adding a file with one of those extensions you should be fine.
Documentation to the command is here
-m is what I wanted, moves the file(s) into a zip.