Testing - Intentionally Corrupt a .Z File Using 'Dd'

testing - intentionally corrupt a .Z file using 'dd'

You could just have used a hex editor like hexedit.

Since you ask though,

dd if=/dev/urandom of=yourfile.z bs=1024 seek=$((RANDOM%10)) count=1 conv=notrunc

will rewrite garbage to a random 1024b block out of the first ten in a file.

How do I corrupt openldap mdb database?

Answered by another post: testing - intentionally corrupt a .Z file using 'dd'

dd if=/dev/urandom of=db.mdb bs=1024 seek=$((RANDOM%10)) count=1 conv=notrunc 

Python CGI script doesn't run

For running python script with httpd in theory You need to check that this is exist:

in httpd.conf :

Include conf.modules.d/*.conf
LoadModule wsgi_module modules/mod_wsgi.so
IncludeOptional conf.d/*.conf # -------------------- End of file

Then You can try to create youvirtualhost.conf in /etc/httpd/conf.d/
And add something like this:

<VirtualHost www.youdomainname.com or *:80>

ServerAdmin admin@youdomainname.com
ServerName www.youdomainname.com
ServerAlias www.youdomainname.com

WSGIApplicationGroup %{GLOBAL}
WSGIProcessGroup %{GLOBAL}

Alias /wsgi-scripts/ /web/wsgi-scripts/
<Location /wsgi-scripts>
SetHandler wsgi-script
Options +ExecCGI
</Location>
<Directory /You/directory/Path>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /You/directory/Path/wsgi.py
</VirtualHost>

Or add this and something from youvirtualhost.conf to end of Your httpd.conf :

  WSGIApplicationGroup %{GLOBAL}
WSGIProcessGroup %{GLOBAL}

Alias /wsgi-scripts/ /web/wsgi-scripts/
<Location /wsgi-scripts>
SetHandler wsgi-script
Options +ExecCGI
</Location>

Also You can visit https://serverfault.com/q/281487 and https://modwsgi.readthedocs.org/en/develop/

store the output of powershell command in a variable

You need to use for /f:

for /f "usebackq" %%x in (`powershell "(Get-Date).AddDays(-8).ToString('dd-MMM-yyyy')"`) do set sun=%%x

Problem showing correct HBase date type in Apache Phoenix

Maybe this should have been a comment because I cannot explain all the details of what has gone wrong nor how you can fix it. But I can see that your problem comes from an inversion of the sign bit of the milliseconds since the epoch. I tried this:

    long milli = OffsetDateTime.parse("2018-12-17T21:21:45+07:00").toInstant().toEpochMilli();
milli += Long.MIN_VALUE; // Flip the sign bit
Date wrongDateAsOldfashiondDate = new Date(milli);
System.out.println(wrongDateAsOldfashiondDate);
System.out.println(new SimpleDateFormat("yyyy-MM-dd").format(wrongDateAsOldfashiondDate));

The output on my computer (in Europe/Copenhagen time zone) was:

Fri Nov 18 08:08:49 CET 292269006
292269006-11-18

Normally one shouldn’t use the old and poorly designed Date class, but this was the way I could get exactly the same result as yours. The difference from the modern date and time API is that Date uses the Julian calendar, so apparently this was also used by the software giving your unexpected result (probably the Date class was involved there too).

How to validate if the input matches a specific timestamp format?

try {
formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
date = (Date) formatter.parse("2012-08-16T11:07:10.793");
} catch(ParseException e) {
// It does not match your input
}

Or, as always use a regular expresion...

EDIT:
Taken maba's typo spotting into account.

End-of-central-directory signature not found. when installing Xcode 8 beta xip file

The XIP file (extract in place) is just a special archive that verifies the unarchive with Apple. On a 2014 MacBook Pro i7 the Xcode 8 binary took over 30 minutes to extract. If the file is not making much progress after close to an hour, re-download the archive and try extracting again.

Additionally, Xcode 8.0 beta requires a Mac running macOS 10.11.4 or later. Make sure your system version is supported.

Xcode 8 Beta 2 note: macOS 10.11.5 or later is required to install Beta 2.



Related Topics



Leave a reply



Submit