View on GitHub

Quorten Blog 1

First blog for all Quorten's blog-like writings

Wow, important Python note. Missing from the documentation? How do you find out what handlers are available on a logger object? Well, there is this undocumented handlers field that you can read from to get the list. Wow, weird.

20160810/http://stackoverflow.com/questions/6333916/python-logging-ensure-a-handler-is-added-only-once

Emacs Daemon mode

2016-08-08

Categories: misc  
Tags: misc  

Emacs Daemon mode? Don’t even need GNU screen and tmux!

20160808/https://www.emacswiki.org/emacs/EmacsAsDaemon
20160808/http://jayconrod.com/posts/42/how-to-use-emacs-like-gnu-screen

Alright, so that’s great!

Setup your own Python Ansible dev machine? This is what you need to do. After I do the usual for setting up my own RHEL 7 machines, I do the following:

yum -y install python-devel openssl-devel libaio readline-devel
yum -y groupinstall 'Development Tools'
# Bootstrap a virtualenv manually for this particular machine.
pip install ansible

Then you can run the Ansible playbook just like normal. Okay, yes there will be a few peculiarities, but overall it will be doable.

Oh yeah, this is very important. 3D scanner notes continued. So, you were asking this question. Yes, as noted above, you learned about some practical designs for cheap scanners, but you’ve also noted that those cheap scanners don’t get very good resolution. Now you’re asking the question. How do you get a scanner that is both cheap and high quality?

Okay, here’s one approach that works very well. You attach your laser line generator to the carriage inside of a flatbed scanner. To keep the cost down, it is very simple and cheap to get an old unwanted flatbed scanner that you can modify. If you suppose that your flatbed scanner only scans one line at a time and needs to step the carriage to scan the very next line, and if your flatbed scanner is capable of scanning at a resolution of 1200 DPI, then you know that the stepper motor that controls the carriage is capable of stepping in increments of 1/1200 inch, or 21.167 micrometers. Pretty good resolution, eh? In other words, this is about 1/50 of a millimeter.

BUT… you complain, this requires mechanical moving parts! Aren’t you saying that modern electronics have been increasingly moving away from mechanical moving parts? “Zero moving parts” is the trend in high-tech computer and information technology equipment. Yes, yes, I know, zero moving parts is the cool new spiffy trend, but look. Hard disk drives still have a much higher information storage density and much better storage economy than solid-state drives. So, although the “zero-moving parts” solutions may be trendy, the fact of the matter is, at present, they are not quite practical to complete deprecate systems that have some moving parts.

Read on →

Local cache of PyPI?

2016-08-03

Categories: python  
Tags: python  

Oh, Python notes. This is interesting. So you want a local cache of PyPi? You have not one, but two methods. Artifactory and devpi.

20160803/http://doc.devpi.net/latest/

Important! How do you extract a Red Hat package manually without installing it? Like this:

rpm2cpio ../giflib-devel-4.1.6-1.fc11.x86_64.rpm | cpio -idmv

20160802/http://www.cyberciti.biz/tips/how-to-extract-an-rpm-package-without-installing-it.html

Oh yeah, and don’t forget how to list packages via yum.

yum list

20160802/https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Listing_Packages.html

Important! How to find which package installed a particular file.

yum whatprovides /usr/bin/msgfmt

Get the installed version of a package:

yum list readline

Want to get the short description on a package? Sorry, you can’t do web search because there is no web directory for CentOS, so instead you must do it in the package manager like follows:

yum search check-devel

So why does Raspberry Pi use more than 3V? Well, here’s a good answer.

20160731/http://raspberrypi.stackexchange.com/questions/46765/why-do-the-pi-gpio-pins-use-give-3-3v-and-not-5v

  • UPDATE 2019-11-20: The primary reason why Raspberry Pi Zero has 5 V power input is because that is the voltage that is required for USB and HDMI. If you do not use those services, as I explain later, you can run straight off of 3 V.

JJJ TODO LINK TWO-WAY!!!

Using `py.test`

2016-08-01

Categories: python  
Tags: python  

Using py.test. Use -r w to show warnings.

20160801/http://stackoverflow.com/questions/33363433/how-to-show-warnings-in-py-test