sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-virtualenv
sudo virtualenv /opt/myenv
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
List some crypto libraries for JavaScript out there. Might be a bit out dated. Scroll to the bottom.
http://www.w3.org/TR/WebCryptoAPI/
This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.
from suds.client import Client | |
url="http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL" | |
client = Client(url) | |
print client ## shows the details of this service | |
result = client.service.GetWeatherInformation() | |
print result ## see: restult.txt below |
import requests | |
url="http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL" | |
#headers = {'content-type': 'application/soap+xml'} | |
headers = {'content-type': 'text/xml'} | |
body = """<?xml version="1.0" encoding="UTF-8"?> | |
<SOAP-ENV:Envelope xmlns:ns0="http://ws.cdyne.com/WeatherWS/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> | |
<SOAP-ENV:Header/> | |
<ns1:Body><ns0:GetWeatherInformation/></ns1:Body> | |
</SOAP-ENV:Envelope>""" |
Обычно после написания кода его проверяют. Если речь о какой-то функции, то можно написать простой скрипт, который будет вызывать ее с разными аргументами, и смотреть, что она вернет. Если вы сделали сайт или приложение, то вы открываете его, жмете ссылки и кнопки, проверяете что все отображается верно. Это называется ручное тестирование или QA (Quality Assurance — контроль качества) — человек проверяет работу программы. Если мы попробуем автоматизировать этот процесс, и написать программу, которая проверяет правильность другой программы, то это называется автоматизированное тестирование.
Главный плюс автоматических тестов — то, что они выполняются намного быстрее, чем ручное тестирование, и вам не надо тратить на это свое время (или время тестировщика). Это позволяет запускать их хоть после каждого изменения в коде.
Также, тесты позволяют «защитить» написанный код. Если кто-то в команде (или вы сами) нечаянно «сломал» ваш код, тесты это обнаружат и укажут, что именн
from django.contrib import admin | |
from django.contrib.auth import admin as auth_admin | |
from .models import * | |
from forms import UserChangeForm, UserCreationForm | |
class UserAdmin(auth_admin.UserAdmin): | |
fieldsets = ( | |
(None, {'fields': ('email', 'password')}), | |
('Personal info', {'fields': ('first_name', 'last_name', 'twitter', 'photo', 'event')}), |
class FieldPermissionsMixin(object): | |
""" | |
A Serializer mixin for controlling which fields are included based on user permissions | |
Usage: | |
class MySerializer(FieldPermissionsMixin, serializers.ModelSerializer): | |
class Meta: | |
model = MyModel | |
field_permissions = { | |
'field': ['app.permission'], |
<?php | |
/** | |
* @param $baseUrl - non protected part of the URL including hostname, e.g. http://example.com | |
* @param $path - protected path to the file, e.g. /downloads/myfile.zip | |
* @param $secret - the shared secret with the nginx server. Keep this info secure!!! | |
* @param $ttl - the number of seconds until this link expires | |
* @param $userIp - ip of the user allowed to download | |
* @return string | |
*/ |
REFERENCES | |
# https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-on-postgresql-on-an-ubuntu-12-04-vps | |
# https://sonnguyen.ws/replication-master-slave-with-postgresql-9-4-in-ubuntu-14-04/ | |
# http://senvichet.com/how-to-setup-postgres-9-4-master-slave-streaming-replication/ | |
============================================================================================================ | |
INITIAL STEPS FOR BOTH MASTER AND SLAVE | |
============================================================================================================ | |
# ----------------------------------------------------------------------------------------------------------- | |
TODO ( STEPS SIMILAR TO SETTING UP AN EC2 INSTANCE ): Install essential software dependencies after system upgrade | |
# ----------------------------------------------------------------------------------------------------------- |