This is copy of Debugging with ipython and ipdb.
- http://pypi.python.org/pypi/setuptools/
- Try to run
which easy_install - Should return something like: /usr/local/share/python/easy_install
This is copy of Debugging with ipython and ipdb.
which easy_install| #Resizes an image and keeps aspect ratio. Set mywidth to the desired with in pixels. | |
| import PIL | |
| from PIL import Image | |
| mywidth = 300 | |
| img = Image.open('someimage.jpg') | |
| wpercent = (mywidth/float(img.size[0])) | |
| hsize = int((float(img.size[1])*float(wpercent))) |
Django documentation says to use:
WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
WSGIPythonPath /path/to/mysite.com
<Directory /path/to/mysite.com/mysite>
<Files wsgi.py>
Require all granted
| function sec2time(timeInSeconds) { | |
| var pad = function(num, size) { return ('000' + num).slice(size * -1); }, | |
| time = parseFloat(timeInSeconds).toFixed(3), | |
| hours = Math.floor(time / 60 / 60), | |
| minutes = Math.floor(time / 60) % 60, | |
| seconds = Math.floor(time - minutes * 60), | |
| milliseconds = time.slice(-3); | |
| return pad(hours, 2) + ':' + pad(minutes, 2) + ':' + pad(seconds, 2) + ',' + pad(milliseconds, 3); | |
| } |
| Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options | |
| This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full. | |
| usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}… | |
| Getting help: | |
| -h — print basic options | |
| -h long — print more options | |
| -h full — print all options (including all format and codec specific options, very long) |
When writing django apps it's easy to ignore the organization of your front end code. Often, these backend coders will just write a static js and css file, stick it in the static directory, and call it a day.
You can also build them as two completely independent parts. With a complex gulp build routine independent of the django app. But if you don't know gulp, node, or those kinds of systems it can be a daunting process to get started with.
Enter django-compressor-toolkit (the name doesn't quite roll off the tongue).
Using django-compressor and django-compressor-toolkit you can write Javascript ES6 code with all its fancy import/export logic or style your pages with sass instead of css, and leave your deploy routine largely untouched.
| # | |
| # This small example shows you how to access JS-based requests via Selenium | |
| # Like this, one can access raw data for scraping, | |
| # for example on many JS-intensive/React-based websites | |
| # | |
| from time import sleep | |
| from selenium import webdriver | |
| from selenium.webdriver import DesiredCapabilities |
| import base64 | |
| from datetime import datetime | |
| from jwcrypto import jwt, jwk # pip install jwcrypto | |
| b64_jwk = "XXXX" # Base64-encoded JWT you get from Cloudflare Stream API (https://developers.cloudflare.com/stream/viewing-videos/securing-your-stream#step-1-call-the-streamkey-endpoint-once-to-obtain-a-key) | |
| jwk_key = jwk.JWK.from_json(base64.b64decode(b64_jwk)) | |
| def get_video_token(video_id: str, lifetime: int = 3600) -> str: | |
| header = {"kid": jwk_key["kid"], "alg": "RS256"} |