Start a long running process in screen and detach¶
- Ssh to the remote host, myremote:
eliot@mylocal:~$ ssh myremote
- Start a new screen session
- Start a long running process, "sleep 3600":
eliot@myremote:~$ sleep 3600
- Detach from the screen session:
(Hit [CTRL-A], then type a colon character, then type "detach", then hit [ENTER])
eliot@myremote:~$ CTRL-A : detach ENTER
- Exit your remote SSH session:
Reattach to the existing screen session¶
- Ssh to the remote host again:
eliot@mylocal:~$ ssh ...
$ pip install --index-url=https://simple.crate.io yolk
$ pip install --log=my-pip-debug.log --index-url=https://simple.crate.io yolk
How to run a Django local development server on a remote machine and access it in your browser on your local machine using SSH port forwarding
Here is how to run a Django local development server on a remote machine and access it in your browser on your local machine using SSH port forwarding. (This is useful if there is a firewall blocking access to the port of your Django local dev server (port 8000).
- On the local host, SSH to the remote host:
$ ssh -v -L 9000:localhost:8000 email@example.com
- On the remote host, run the Django dev server:
firstname.lastname@example.org:/path/to/my/django/project$ python manage.py runserver 0.0.0.0:8000
- On the local host, go ...
Our website is served over HTTPS. To more easily test certain issues (e.g. mixed mode content warnings, or Mapquest SSL tile servers), I wanted to access my Flask local development server over HTTPS. These two articles describe how to do this using stunnel: Testing HTTPS with Django's Development Server, Django Development Server with HTTPS. Using stunnel, you can hit pages on your Django/Flask local dev server over HTTPS instead of HTTP. Here is how I installed it on Ubuntu Precise 12.04:
- Install SSL development files
$ sudo apt-get install libssl-dev
- Go to https://www.stunnel.org/downloads ...
Setting up MythTV involves a little pain, but once it's set up, it's pretty great. And you don't have to spend lots of money on a DVR from the cable company. With my modest hardware specs, playback is smooth and clear, however Picture in Picture is too jittery to be useful. Here's what I did to get my MythTV DVR running on my Ubuntu machine.
- Ubuntu 12.04 LTS (Precise Pangolin)
- MythTV 0.25
- Hauppauge 1196 WinTV-HVR-1250 PCI-E x1 TV Tuner 1196 (The included remote does not work with Linux. However this Anker Mini Bluetooth ...
Some of our Python unit tests have docstrings. I find it annoying that, when using a verbosity level >= 2, nose prints the docstring instead of the class name and method name. Here's a hack to prevent it from doing that: Add a shortDescription() method to the test case class that returns None.
Here is an example of normal behavior:
import unittest class MyTestCase(unittest.TestCase): def test_with_docstring(self): """Test that something does something """ def test_without_docstring(self): pass
$ nosetests --verbosity=2 tmp.py Test that something does something ... ok test_without_docstring (tmp.MyTestCase) ... ok
Here is an example with the hack ...... read more »
I want to share and sync (in real time) Google (Gmail) contacts with my wife on our Android 2.3.6 Gingerbread phones. Google does not make this easy to do. Here's the best solution I could come up with (ref whitenack on androidcentral). (Note: these are not our real email addresses.)
- This contact list resides only on the email@example.com account.
- Contacts are removed from the "My Contacts" group and instead stored in groups called "Angela" and/or "Eliot". For shared contacts, the contact is in both groups. (Contact groups are like tags. A contact can be ...
It's fun to use nose + coverage.py to show my progress as I write tests. Seeing the bar next to my code change from red to green makes me happy. 100% test coverage does not mean tests are complete. For example, a boolean OR'ed conditional expression may not test all conditions even though the line is marked as covered. Other limitations are discussed here: Flaws in coverage measurement. However, good test coverage is at least a step towards having a good test suite.
Install nose and coverage.py¶
Activate your virtualenv and pip install nose and coverage.
$ pip ...
The Pycon 2012 videos are up at pyvideo.org. Here are some of the talks I enjoyed that I saw. I know I probably missed some great talks so I will try to watch more online. Let me know if there are some that I should not miss.
Favorite talk of the conference
Saturday Keynote: Let's Talk About pypy
by David Beazley.
It was awesome! See also his
post Pycon blog post
Other great talks (in chronological order)
The Art of Subclassing by
Great instruction on a topic I struggle with (object-oriented code).
- Stop Writing Classes by ...
This is a simple Redis-based queue. Two features that I needed were uniqueness (i.e. if an item exists in the queue already, it won't be added again) and a delay, like beanstalkd, where an item must wait a specified time before it can be popped from the queue. There are a number of other Redis-based queues that have many more features but I didn't see one that had these two features together. This 50-line class works for my needs. It may or may not work for you. Feel free to copy this and build on it ...... read more »