Wednesday, July 9, 2014

Single Line Web Server in Python

This is an old trick, but very useful for transferring files in a pinch - especially in cross platform situations. Also great if you need a simple web server for testing.

The commands are simple.

For Python 2.x: python -m SimpleHTTPServer
[user@fedora folder1]$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
For Python 3.x: python3 -m http.server
[user@fedora folder1]$ python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...
Both of these default to port 8000, but you can add a port number to the end of the line to specify something else if you like. The current directory is used as the root folder. If an index.html or index.htm file is present it will be served initially, otherwise the server will provide a directory listing. Just point your browser to the system:
http://<your-ip-address>:8000
Make sure your firewall/IP-tables are properly adjusted to allow the inbound connection.

The terminal will show a running Apache style access log of connections. CTRL + c to exit.

Performance is pretty good too:



Official documentation here:
https://docs.python.org/2/library/simplehttpserver.html
https://docs.python.org/3/library/http.server.html


Tuesday, April 1, 2014

Quick Decimal, Hex, Binary, Octal Conversion on Windows

Sometimes you just need a quick and dirty way to convert between number systems (decimal, hex, octal, binary). The built in Windows calculator will actually do this for you. Simply start the calculator and under "View" choose "Programmer".


This should switch to the Programmer calculator view. Set the mode to whatever number system you are converting from - it should default to Decimal, and enter the number.


From here you just select the number system you want to convert to.


The number auto updates to the new number system. Done, quick and easy.

Friday, December 6, 2013

Cooling Down an ITX Board by Replacing Junk Thermal Pads

About a year ago I picked up the Sapphire Pure Mini E-350. I subsequently put a system together around it on the cheap over the next 2-3 months as some good deals showed up. It's performed well enough for some light HTPC duties (Netflix, a little indie gaming, etc.), and has enough expansion options and flexibility to have some decent longevity.


Being a mini-ITX board, the cooling is nothing to really write home about - especially with its screaming 40mm CPU fan, but this really shouldn't matter since it has such a low power draw. Since I had recently toyed with the option of leaving it on 24x7 I decided it was time to double check just how bad the temps could get if left unchecked. So I started OpenHardwareMonitor, loaded up the CPU and GPU and let it sit for an hour. Upon coming back to check how things were, I was pretty shocked:


Looking at the temps:
Max CPU: 89.8° C
Max GPU: 90.0° C
Max Temp 1: 78.0° C (I'm assuming this is the FCH -Fusion Controller Hub, see why below)

Just a note that the CPU and GPU temps should always be almost identical considering both parts are on the same die.

After idling for a while temps dropped to around the current values in the screenshot above:
Idle CPU: 62.0° C
Idle GPU: 62.0° C
Idle Temp 1: 52.0 C

Not what I like to see for a product I'm thinking of holding onto for a while. Let's see what the problem is.

The two heatsinks on the board have to be for the APU (CPU and GPU), and FCH. The APU (AMD E-350) has a max TDP of 18 watts, and FCH (AMD A50M) of 5.9 watts. Fully loaded these will get pretty toasty. Time to void the warranty.

First, we pop off the APU heatsink. It's mounted well with 4 spring loaded screws from the back. It has a crappy thermal pad slapped on the bottom:


Notice how thick the material is where the APU made contact - not good for thermal conduction at all. Residue still on the APU, you can see how brittle the material is:


I removed the residue from the APU with isopropyl alcohol. Then, I scrapped it off the bottom of the heatsink with a small wooden skewer. The entire bottom is a rough finish of anodized aluminum. To do this right, the bottom should really be sanded and lapped to a nice finish, maybe a project for another day. At this point - lets check on the FCH:


Same story as before, looks like the pad was almost folded over too. I finished cleaning everything up - we're ready for some thermal paste:



I applied some Arctic Silver I had lying around - really almost anything would be better then the original stuff. Once everything was back together, I powered on and went strait to the BIOS to monitor temps before booting. Things looked good, so I let it boot and ran our test again:


What a huge difference:

Max CPU: 75.3° C        - Δ of 14.5° C
Max GPU: 75.0° C        - Δ of 15.0° C
Max Temp 1: 62.0° C    - Δ of 16.0° C

Idle CPU: 47.5° C          - Δ of 14.5° C
Idle GPU: 47.0° C          - Δ of 15.0° C
Idle Temp 1: 36.0° C      - Δ of 16.0° C

What a huge difference! I was kind of surprised that the temp delta was identical between load and idle, but this is likely due to the rough bottom of the heatsink. Things should only improve as Artic Silver takes several heating/cooling cycles to spread out and "flow" evenly.

Looking at improving things further, the APU heatsink is larger then the 40mm fan. I test fitted a 60mm fan and it would fit while hanging off on one side. This would provide increased airflow over a larger surface area, all while spinning at at a slower speed. I could have this fan hang over the passively cooled FCH heatsink, further improving tempts there.

The board does also support a 4-pin PWM fan on the CPU. This would be an additional option to quiet things down when idle.

I'll update in a few weeks once the thermal paste has cycled a bit.