Host photos locally

This commit is contained in:
Dan Bader
2018-07-16 17:51:29 -07:00
parent 71e387ada6
commit 03ed5fbf0d
92 changed files with 168 additions and 168 deletions
+19 -19
View File
@@ -1,7 +1,7 @@
Systems Administration
======================
.. image:: https://farm5.staticflickr.com/4179/34435690580_3afec7d4cd_k_d.jpg
.. image:: /_static/photos/34435690580_3afec7d4cd_k_d.jpg
Fabric
------
@@ -234,37 +234,37 @@ The Ansible playbook will ping all of the servers in the :file:`hosts.yml` file.
You can also select groups of servers using Ansible. For more information
about Ansible, read the `Ansible Docs <http://docs.ansible.com/>`_.
`An Ansible tutorial <https://serversforhackers.com/an-ansible-tutorial/>`_ is also a
`An Ansible tutorial <https://serversforhackers.com/an-ansible-tutorial/>`_ is also a
great and detailed introduction to getting started with Ansible.
Chef
----
`Chef <https://www.chef.io/chef/>`_ is a systems and cloud infrastructure automation
framework that makes it easy to deploy servers and applications to any physical,
virtual, or cloud location. In case this is your choice for configuration management,
you will primarily use Ruby to write your infrastructure code.
`Chef <https://www.chef.io/chef/>`_ is a systems and cloud infrastructure automation
framework that makes it easy to deploy servers and applications to any physical,
virtual, or cloud location. In case this is your choice for configuration management,
you will primarily use Ruby to write your infrastructure code.
Chef clients run on every server that is part of your infrastructure and these regularly
check with your Chef server to ensure your system is always aligned and represents the
desired state. Since each individual server has its own distinct Chef client, each server
Chef clients run on every server that is part of your infrastructure and these regularly
check with your Chef server to ensure your system is always aligned and represents the
desired state. Since each individual server has its own distinct Chef client, each server
configures itself and this distributed approach makes Chef a scalable automation platform.
Chef works by using custom recipes (configuration elements), implemented in cookbooks. Cookbooks, which are basically
packages for infrastructure choices, are usually stored in your Chef server.
Read the `Digital Ocean tutorial series
<https://www.digitalocean.com/community/tutorials/how-to-install-a-chef-server-workstation-and-client-on-ubuntu-vps-instances>`_
Chef works by using custom recipes (configuration elements), implemented in cookbooks. Cookbooks, which are basically
packages for infrastructure choices, are usually stored in your Chef server.
Read the `Digital Ocean tutorial series
<https://www.digitalocean.com/community/tutorials/how-to-install-a-chef-server-workstation-and-client-on-ubuntu-vps-instances>`_
on chef to learn how to create a simple Chef Server.
To create a simple cookbook the `knife <https://docs.chef.io/knife.html>`_ command is used:
.. code-block:: console
.. code-block:: console
knife cookbook create cookbook_name
`Getting started with Chef <http://gettingstartedwithchef.com/first-steps-with-chef.html>`_
is a good starting point for Chef Beginners and many community maintained cookbooks that can
serve as a good reference or tweaked to serve your infrastructure configuration needs can be
`Getting started with Chef <http://gettingstartedwithchef.com/first-steps-with-chef.html>`_
is a good starting point for Chef Beginners and many community maintained cookbooks that can
serve as a good reference or tweaked to serve your infrastructure configuration needs can be
found on the `Chef Supermarket <https://supermarket.chef.io/cookbooks>`_.
- `Chef Documentation <https://docs.chef.io/>`_
@@ -304,7 +304,7 @@ your Puppet modules.
.. code-block:: console
$ facter operatingsystem
Ubuntu
Ubuntu
Writing Modules in Puppet is pretty straight forward. Puppet Manifests together
form Puppet Modules. Puppet manifest end with an extension of ``.pp``.
@@ -374,7 +374,7 @@ Buildout
--------
`Buildout <http://www.buildout.org>`_ is an open source software build tool.
Buildout is created using the Python programming language. It implements a
Buildout is created using the Python programming language. It implements a
principle of separation of configuration from the scripts that do the setting up.
Buildout is primarily used to download and set up dependencies in Python eggs
format of the software being developed or deployed. Recipes for build tasks in any
+1 -1
View File
@@ -1,7 +1,7 @@
Continuous Integration
======================
.. image:: https://farm5.staticflickr.com/4173/33907150594_9abba7ad0a_k_d.jpg
.. image:: /_static/photos/33907150594_9abba7ad0a_k_d.jpg
.. note::
For advice on writing your tests, see :doc:`/writing/tests`.
+5 -5
View File
@@ -1,7 +1,7 @@
Command-line Applications
=========================
.. image:: https://farm5.staticflickr.com/4272/34435690330_11930b5987_k_d.jpg
.. image:: /_static/photos/34435690330_11930b5987_k_d.jpg
Command-line applications, also referred to as
`Console Applications <http://en.wikipedia.org/wiki/Console_application>`_,
@@ -68,9 +68,9 @@ sub-command to do the work.
Cement
------
`Cement <http://builtoncement.com/>`_ is an advanced CLI Application Framework.
`Cement <http://builtoncement.com/>`_ is an advanced CLI Application Framework.
Its goal is to introduce a standard, and feature-full platform
for both simple and complex command line applications as well
as support rapid development needs without sacrificing quality.
Cement is flexible, and it's use cases span from the simplicity of a micro-framework
to the complexity of a meg-framework.
as support rapid development needs without sacrificing quality.
Cement is flexible, and it's use cases span from the simplicity of a micro-framework
to the complexity of a meg-framework.
+4 -4
View File
@@ -1,7 +1,7 @@
Interfacing with C/C++ Libraries
================================
.. image:: https://farm5.staticflickr.com/4173/34725951345_c8f5959a2e_k_d.jpg
.. image:: /_static/photos/34725951345_c8f5959a2e_k_d.jpg
C Foreign Function Interface
----------------------------
@@ -105,20 +105,20 @@ Example: Overloading __repr__
:linenos:
%include "string.i"
%module myclass
%{
#include <string>
#include "MyClass.h"
%}
%extend MyClass {
std::string __repr__()
{
return $self->getName();
}
}
%include "MyClass.h"
+1 -1
View File
@@ -1,7 +1,7 @@
Network Applications
====================
.. image:: https://farm5.staticflickr.com/4251/34364815780_bea6614025_k_d.jpg
.. image:: /_static/photos/34364815780_bea6614025_k_d.jpg
HTTP
::::
+3 -3
View File
@@ -1,13 +1,13 @@
Cryptography
============
.. image:: https://farm5.staticflickr.com/4220/33907152824_bf91078cc1_k_d.jpg
.. image:: /_static/photos/33907152824_bf91078cc1_k_d.jpg
Cryptography
------------
`Cryptography <https://cryptography.io/en/latest/>`_ is an actively developed
library that provides cryptographic recipes and primitives. It supports
library that provides cryptographic recipes and primitives. It supports
Python 2.6-2.7, Python 3.3+ and PyPy.
@@ -60,7 +60,7 @@ Example
.. code-block:: python3
import gpg
# Encryption to public key specified in rkey.
a_key = input("Enter the fingerprint or key ID to encrypt to: ")
filename = input("Enter the filename to encrypt: ")
+1 -1
View File
@@ -1,7 +1,7 @@
Databases
=========
.. image:: https://farm5.staticflickr.com/4225/33907152464_a99fdcc8de_k_d.jpg
.. image:: /_static/photos/33907152464_a99fdcc8de_k_d.jpg
DB-API
------
+1 -1
View File
@@ -1,7 +1,7 @@
GUI Applications
================
.. image:: https://farm5.staticflickr.com/4250/33907143624_cd621b535c_k_d.jpg
.. image:: /_static/photos/33907143624_cd621b535c_k_d.jpg
Alphabetical list of GUI Applications.
+1 -1
View File
@@ -2,7 +2,7 @@
Image Manipulation
==================
.. image:: https://farm5.staticflickr.com/4157/34575689432_3de8e9a348_k_d.jpg
.. image:: /_static/photos/34575689432_3de8e9a348_k_d.jpg
Most image processing and manipulation techniques can be carried out
effectively using two libraries: Python Imaging Library (PIL) and OpenSource
+2 -2
View File
@@ -1,7 +1,7 @@
JSON
====
.. image:: https://farm5.staticflickr.com/4174/33928819683_97b5c6a184_k_d.jpg
.. image:: /_static/photos/33928819683_97b5c6a184_k_d.jpg
The `json <https://docs.python.org/2/library/json.html>`_ library can parse
JSON from strings or files. The library parses JSON into a Python dictionary
@@ -60,7 +60,7 @@ You can start using simplejson when the json library is not available by
importing simplejson under a different name:
.. code-block:: python
import simplejson as json
After importing simplejson as json, the above examples will all work as if you
+8 -8
View File
@@ -2,9 +2,9 @@
Machine Learning
================
.. image:: https://farm4.staticflickr.com/3954/34018729885_002ced9b54_k_d.jpg
.. image:: /_static/photos/34018729885_002ced9b54_k_d.jpg
Python has a vast number of libraries for data analysis, statistics and Machine Learning itself, making it a language of choice for many data scientists.
Python has a vast number of libraries for data analysis, statistics and Machine Learning itself, making it a language of choice for many data scientists.
Some widely used packages for Machine Learning and other Data Science applications are enlisted below.
@@ -45,7 +45,7 @@ Installation
Through PyPI:
.. code-block:: python
pip install -U scikit-learn
Through conda:
@@ -61,28 +61,28 @@ Example
For this example, we train a simple classifier on the `Iris dataset <http://en.wikipedia.org/wiki/Iris_flower_data_set>`_, which comes bundled in with scikit-learn.
The dataset takes four features of flowers: sepal length, sepal width, petal length and petal width, and classifies them into three flower species (labels): setosa, versicolor or virginica. The labels have been represented as numbers in the dataset: 0 (setosa), 1 (versicolor) and 2 (virginica).
The dataset takes four features of flowers: sepal length, sepal width, petal length and petal width, and classifies them into three flower species (labels): setosa, versicolor or virginica. The labels have been represented as numbers in the dataset: 0 (setosa), 1 (versicolor) and 2 (virginica).
We shuffle the Iris dataset, and divide it into separate training and testing sets: keeping the last 10 data points for testing and rest for training. We then train the classifier on the training set, and predict on the testing set.
.. code-block:: python
from sklearn.datasets import load_iris
from sklearn.datasets import load_iris
from sklearn import tree
from sklearn.metrics import accuracy_score
import numpy as np
#loading the iris dataset
iris = load_iris()
iris = load_iris()
x = iris.data #array of the data
y = iris.target #array of labels (i.e answers) of each data entry
#getting label names i.e the three flower species
y_names = iris.target_names
y_names = iris.target_names
#taking random indices to split the dataset into train and test
test_ids = np.random.permutation(len(x))
test_ids = np.random.permutation(len(x))
#splitting data and labels into train and test
#keeping last 10 entries for testing, rest for training
+2 -2
View File
@@ -1,7 +1,7 @@
Networking
==========
.. image:: https://farm3.staticflickr.com/2892/34151833832_6bdfd930af_k_d.jpg
.. image:: /_static/photos/34151833832_6bdfd930af_k_d.jpg
Twisted
-------
@@ -35,4 +35,4 @@ gevent
`gevent <http://www.gevent.org/>`_ is a coroutine-based Python networking
library that uses greenlets to provide a high-level synchronous API on top of
the libev event loop.
the libev event loop.
+1 -1
View File
@@ -2,7 +2,7 @@
Scientific Applications
=======================
.. image:: https://farm3.staticflickr.com/2890/33925223870_97e44f5629_k_d.jpg
.. image:: /_static/photos/33925223870_97e44f5629_k_d.jpg
Context
:::::::
+1 -1
View File
@@ -1,7 +1,7 @@
HTML Scraping
=============
.. image:: https://farm3.staticflickr.com/2900/34268661876_442428e122_k_d.jpg
.. image:: /_static/photos/34268661876_442428e122_k_d.jpg
Web Scraping
------------
+15 -15
View File
@@ -2,41 +2,41 @@
Data Serialization
==================
.. image:: https://farm3.staticflickr.com/2927/33467946364_3e59bd376a_k_d.jpg
.. image:: /_static/photos/33467946364_3e59bd376a_k_d.jpg
What is data serialization?
---------------------------
Data serialization is the concept of converting structured data into a format
that allows it to be shared or stored in such a way that its original
structure to be recovered. In some cases, the secondary intention of data
serialization is to minimize the size of the serialized data which then
Data serialization is the concept of converting structured data into a format
that allows it to be shared or stored in such a way that its original
structure to be recovered. In some cases, the secondary intention of data
serialization is to minimize the size of the serialized data which then
minimizes disk space or bandwidth requirements.
Pickle
------
The native data serialization module for Python is called `Pickle
<https://docs.python.org/2/library/pickle.html>`_.
The native data serialization module for Python is called `Pickle
<https://docs.python.org/2/library/pickle.html>`_.
Here's an example:
.. code-block:: python
import pickle
#Here's an example dict
grades = { 'Alice': 89, 'Bob': 72, 'Charles': 87 }
#Use dumps to convert the object to a serialized string
serial_grades = pickle.dumps( grades )
#Use loads to de-serialize an object
#Use loads to de-serialize an object
received_grades = pickle.loads( serial_grades )
Protobuf
--------
If you're looking for a serialization module that has support in multiple
languages, Google's `Protobuf
<https://developers.google.com/protocol-buffers>`_ library is an option.
If you're looking for a serialization module that has support in multiple
languages, Google's `Protobuf
<https://developers.google.com/protocol-buffers>`_ library is an option.
+8 -8
View File
@@ -1,7 +1,7 @@
Speed
=====
.. image:: https://farm3.staticflickr.com/2826/33175625804_e225b90f3e_k_d.jpg
.. image:: /_static/photos/33175625804_e225b90f3e_k_d.jpg
CPython, the most commonly used implementation of Python, is slow for CPU bound
tasks. `PyPy`_ is fast.
@@ -234,14 +234,14 @@ Concurrent.futures
The `concurrent.futures`_ module is a module in the standard library that
provides a "high-level interface for asynchronously executing callables". It
abstracts away a lot of the more complicated details about using multiple
threads or processes for concurrency, and allows the user to focus on
threads or processes for concurrency, and allows the user to focus on
accomplishing the task at hand.
The `concurrent.futures`_ module exposes two main classes, the
`ThreadPoolExecutor` and the `ProcessPoolExecutor`. The ThreadPoolExecutor
will create a pool of worker threads that a user can submit jobs to. These jobs
will then be executed in another thread when the next worker thread becomes
available.
available.
The ProcessPoolExecutor works in the same way, except instead of using multiple
threads for its workers, it will use multiple processes. This makes it possible
@@ -275,7 +275,7 @@ everything in parallel. :
# Do something with the result
print(page.text)
For even more control, the `submit(func, *args, **kwargs)` method will schedule
For even more control, the `submit(func, *args, **kwargs)` method will schedule
a callable to be executed ( as `func(*args, **kwargs)`) and returns a `Future`_
object that represents the execution of the callable.
@@ -389,9 +389,9 @@ still alive (because the join call timed out):
Because multiple threads have access to the same section of memory, sometimes
there might be situations where two or more threads are trying to write to the
same resource at the same time or where the output is dependent on the sequence
or timing of certain events. This is called a `data race`_ or race condition.
or timing of certain events. This is called a `data race`_ or race condition.
When this happens, the output will be garbled or you may encounter problems
which are difficult to debug. A good example is this `stackoverflow post`_.
which are difficult to debug. A good example is this `stackoverflow post`_.
The way this can be avoided is by using a `Lock`_ that each thread needs to
acquire before writing to a shared resource. Locks can be acquired and released
@@ -412,7 +412,7 @@ through either the contextmanager protocol (`with` statement), or by using
def monitor_website(some_website):
"""
Monitor a website and then if there are any changes,
Monitor a website and then if there are any changes,
log them to disk.
"""
while True:
@@ -429,7 +429,7 @@ Here, we have a bunch of threads checking for changes on a list of sites and
whenever there are any changes, they attempt to write those changes to a file
by calling `log(changes)`. When `log()` is called, it will wait to acquire
the lock with `with file_lock:`. This ensures that at any one time, only one
thread is writing to the file.
thread is writing to the file.
Spawning Processes
------------------
+4 -4
View File
@@ -2,7 +2,7 @@
Web Applications & Frameworks
=============================
.. image:: https://farm3.staticflickr.com/2891/34309496175_b82d104282_k_d.jpg
.. image:: /_static/photos/34309496175_b82d104282_k_d.jpg
As a powerful scripting language adapted to both fast prototyping
and bigger projects, Python is widely used in web application
@@ -99,7 +99,7 @@ to build RESTful API microservices that are fast and scalable.
It is a reliable, high-performance Python web framework for building large-scale
app backends and microservices. Falcon encourages the REST architectural style of
mapping URIs to resources, trying to do as little as possible while remaining highly effective.
mapping URIs to resources, trying to do as little as possible while remaining highly effective.
Falcon highlights four main focuses: speed, reliability, flexibility and debuggability.
It implements HTTP through "responders" such as ``on_get()``, ``on_put()``, etc.
@@ -120,9 +120,9 @@ Pyramid
`Pyramid <https://trypyramid.com/>`_ is a very flexible framework with a heavy
focus on modularity. It comes with a small number of libraries ("batteries")
built-in, and encourages users to extend its base functionality. A set of
built-in, and encourages users to extend its base functionality. A set of
provided cookiecutter templates helps making new project decisions for users.
It poweres one of the most important parts of python infrastucture
It poweres one of the most important parts of python infrastucture
`PyPI <http://pypi.org/>`_.
Pyramid does not have a large user base, unlike Django and Flask. It's a
+1 -1
View File
@@ -1,7 +1,7 @@
XML parsing
===========
.. image:: https://farm3.staticflickr.com/2808/33888714601_a1f7d020a2_k_d.jpg
.. image:: /_static/photos/33888714601_a1f7d020a2_k_d.jpg
untangle
--------