an inconceivable bug of STM32CubeMX….

The default value of Heap and Stack in STM32CubeMX is 0x200 bytes Heap and 0x400 bytes Stack.

Which is work fine in most situation.

BUT the middleware of USBStack use malloc! for TX and RX buffer!!!
That will make the USB enumerate process fail (some yellow exclamation point).
At that time, system still recognize that device, so I can’t get the point, waste much time to debug and tracing.

It is better to increase this automatically when user enable USB stack?

After change heap to 0x800, everything fine.

STM32F103 marking summary

This is collection I got.

and compare with PCN-8363-2014.03.31.pdf PCN-8390-2014.05.07.pdf PCN-9484-2015.12.17.pdf PCN-9511-2016.04.22.pdf PCN-9685-2016.04.19.pdf

Assembly Plant

Country of Origin

Manufactured date

The problem is, howto identify 2003 or 2013?

Interconnect

Chip revision

Bug in Python3.6 standard library when compile using MinGW

Python36 is compiled by Visual Studio 2015 or MSBuild tools 2015, which included Compiler v19.00 (MSC_VER 1600). But “C:\Python36\Lib\distutils\cygwinccompiler.py” can’t handle it…

I modify it simply like this:

Dump PE file

I am using some tool to check a PE file (dll or exe) depends, most free tool support 32bits file.
So I decided to write an tool support 32bits and 64bits PE file.

The PE struct is defined in MinGW’s headers. So What I need to do is write a parser and make some test.

the PE file is like this

An example PE header is

Both EXE and DLL file, the first 128 bytes is the same. This a DOS program, which print that message above. The MAGIC is “MZ”

Then is `e_lfanew`, which is `80 00 00 00`, point to new NT header.

the NT header is:

The Opt Header is difference between 32bits and 64bits!
The first WORD of Opt header is magic, for 32bits is 0x010B, 64bits is 0x020B.

So we can write a script to show PE type

which will output like `file` command:

For more details, see the source code

https://github.com/buaabyl/pedump

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

Remove unnecessary php file please

When I analysis web server log file, I found this

That means someone checking my files, and want to get the MySQL password?

It is better to prevent this location in web server!

the format of openssh public key

The openssh public key is like this :

using openssl to decode it:

And I write a python script to decode it, and found the format like this:

The sample python code:

Fix wordpress 301 loop when enable nginx…

I am try to setup Nginx as reverse proxy, backend is Apache, the problem is WordPress always 301 to the same URL even if the browser request that URL (301 loop).


client <---> nginx(https) <---> apache(http)

The problem is WordPress think the site is on port 80 enable https, but actually apache is on 8080 without https, and Nginx is on 80 with https, so it request 301 to that ‘correct’ site… See below.

After digging Google for a long time, and found some solutions at the end.

this is my solution temporary. Just comment out canonical, because I don’t need it.

update:

After trace Nginx and Apache traffic, I found that Nginx always add ‘index.php’ to ‘/’, then send to apache, but wordpress will make 301 redirect to ‘/’, so browser request ‘/’ again, when Nginx received, it add ‘index.php’ to it and send to apache again, loop…

the solution is:

And append this to wp-config.php

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License