You can install Python-3.6 on debian 8 as follows:
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar xvf Python-3.6.0.tgz
cd Python-3.6.0
./configure --enable-optimizations
make -j8
/* | |
* This function scans through all files in the wp-content/uploads | |
* folders and imports them into the media library. This should be | |
* included in your theme's functions.php file. Simply visit your | |
* website, including the URL param: | |
* http://www.example.org/?import_non_existing_media_library_entries=1 | |
* | |
* Plan on it timing out a few times. Just keep refreshing. It won't | |
* duplicate files being imported. | |
*/ |
Fixing Settings | |
We’re on a mission to fix your bad settings files here. We show this layout to new clients and I’m constantly surprised how few people know this is even possible to do. I blame the fact that while everyone knows that settings are just Python code, they don’t think about them as Python code. | |
So let’s fix up our settings. For our foo project we’re going to have 4 environments: dev, stage, jenkins, and production. So let’s give each it’s own file. The process to do this is: | |
In foo/foo/ make a settings directory and create an empty __init__.py file inside it. | |
Move foo/foo/settings.py into foo/foo/settings/base.py | |
Create the individual dev.py, stage.py, jenkins.py, and prod.py files in foo/foo/settings/. Each of these 4 environment specific files should simply contain the following: | |
from base import * |
- http://www.devdungeon.com/content/working-binary-data-python | |
- https://docs.python.org/2/library/shutil.html#shutil.make_archive |
import types | |
class Timed(object): | |
def __init__(self, f): | |
self.func = f | |
def __call__(self, *args, **kwargs): | |
start = dt.datetime.now() | |
ret = self.func(*args, **kwargs) | |
time = dt.datetime.now() - start |
class SimpleNamespace: | |
def __init__(self, **kwargs): | |
self.__dict__.update(kwargs) | |
def __repr__(self): | |
keys = sorted(self.__dict__) | |
items = ('{}={!r}'.format(k, self.__dict__[k]) for k in keys) | |
return '{}({})'.format(type(self).__name__, ', '.join(items)) |
dir > a.txt 2>&1 |
from IPython.display import SVG, display |
os.chdir(path) | |
os.path.dirname(os.path.abspath(__file__)) | |
os.path.dirname(os.path.realpath(__file__)) | |
os.path.abspath(os.path.dirname(sys.argv[0])) | |
# Long | |
import os | |
print('Path at terminal when executing this file') | |
print(os.getcwd() + '\n') |
http://airbnb.io/superset/index.html |