Forward X11
vagrant ssh -- -Y
Forward X11
vagrant ssh -- -Y
To automatically do something at start up of OpenElec, place a shell script at /storage/.config/autostart.sh. | |
For example, to start playing a playlist at start up, you can place the following in autostart.sh, which will launch a different script in the background (and release, so XBMC will start): | |
#!/bin/sh | |
play_videos.sh | |
This is the content of play_videos.sh, which checks to see if xbmc is running first, and then release. Waits about 20 seconds to ensure XBMC started up completely, then play the video playlist: |
# Tuple abs val | |
def tup_abs(t): | |
return math.sqrt(t[0]*t[0] + t[1]*t[1] + t[2]*t[2]) | |
# Look for attributes of an object | |
# Find s in attributes of o | |
def find_attr(o, s): | |
import re | |
regex = re.compile(r'.*'+s+'.*') | |
return [ at for at in dir(o) if regex.match(at) is not None ] |
Tips for getting your patches accepted: | |
Don't needlessly break compatibility with older versions of PyCrypto. Patches that break compatibility with older version of PyCrypto, especially PyCrypto 2.0.1, will need an explanation about why it's worth breaking compatibility. Exception: Removing buggy code that nobody uses is fine. | |
Don't needlessly break compatibility with older versions of Python. Run the test suite using Python 2.1 and the latest version of Python 2.x. | |
Don't needlessly add complexity. The more complex the code is, the harder it is to maintain, and the more likely it is to have bugs. | |
Don't needlessly add features. Seriously. X.509 doesn't belong in PyCrypto. Or anywhere, really. | |
Don't create copyright headaches. It took me the better part of a year to sort out the licensing ambiguities in PyCrypto 2.0.1. If you're adding new files, include the standard PyCrypto public domain dedication at the top. | |
Whatever you do in _fastmath.c, also do in _slowmath.py. PyCrypto has two math libraries: one that |
Installing Pillow under Ubuntu & virtualenv is pretty simple. It's just:
pip install Pillow
However, getting the support for the image formats might take some guess work. The following takes that guess work out for you. Install the library listed with apt-get install to get the needed support for the image format.
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
import datetime | |
datetime.datetime.fromtimestamp( | |
int("1284101485") | |
).isoformat() |
# https://docs.python.org/3/library/venv.html | |
# Under Ubuntu Xenial64, install the following package before getting started | |
sudo apt-get install python3-venv | |
# Usage: python3 -m venv [directory] | |
python3 -m venv ~/env/web | |
. ~/env/web/bin/activate |
To use this, place the docker-compose.yaml
file in a new directory.
Then run:
docker-compose up
Once up, you can access http://localhost:8080 to administrate the db. Login with: postgres/example
Or run this from another terminal for command line access:
docker-compose exec db bash
# An example tornado request handler that handles both JSON POST request | |
# bodies and x-www-form-urlencoded POST bodies. | |
# | |
# The benefit of JSON request bodies are more complicated and potentially | |
# nested dict and list data types. | |
# | |
# One drawback to JSON request bodies is that arguments can come in | |
# different types, so handlers will need to perform additional checks. | |
# With x-www-form-urlencoded fields, all argument values are strings, if | |
# they exist. |