Skip to content

Instantly share code, notes, and snippets.

View Barolina's full-sized avatar

꧁꧂Larisa Barolina

View GitHub Profile
@plentz
plentz / nginx.conf
Last active May 17, 2024 09:08
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@ravidsrk
ravidsrk / Install.md
Last active September 30, 2021 15:46
Deploying django application with gunicorn nginx mysql

Step One: Update Packages

sudo apt-get update
sudo apt-get upgrade

Step Two: Install and Create Virtualenv

sudo apt-get install python-virtualenv
sudo virtualenv /opt/myenv
@jo
jo / js-crypto-libraries.md
Last active May 22, 2024 13:16
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

List some crypto libraries for JavaScript out there. Might be a bit out dated. Scroll to the bottom.

WebCryptoAPI

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.

@toast38coza
toast38coza / call_weather_service.py
Created August 29, 2014 08:25
Calling a SOAP WebService with Python Suds
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
@toast38coza
toast38coza / call_soap_with_requests.py
Created October 22, 2014 11:17
Call a SOAP Service with plain old requests
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>"""
@codedokode
codedokode / Тестирование.md
Last active April 25, 2024 20:24
Автоматизированное тестирование

Автоматизированное тестирование

Обычно после написания кода его проверяют. Если речь о какой-то функции, то можно написать простой скрипт, который будет вызывать ее с разными аргументами, и смотреть, что она вернет. Если вы сделали сайт или приложение, то вы открываете его, жмете ссылки и кнопки, проверяете что все отображается верно. Это называется ручное тестирование или QA (Quality Assurance — контроль качества) — человек проверяет работу программы. Если мы попробуем автоматизировать этот процесс, и написать программу, которая проверяет правильность другой программы, то это называется автоматизированное тестирование.

Главный плюс автоматических тестов — то, что они выполняются намного быстрее, чем ручное тестирование, и вам не надо тратить на это свое время (или время тестировщика). Это позволяет запускать их хоть после каждого изменения в коде.

Также, тесты позволяют «защитить» написанный код. Если кто-то в команде (или вы сами) нечаянно «сломал» ваш код, тесты это обнаружат и укажут, что именн

@haxoza
haxoza / admin.py
Created April 17, 2015 09:03
Django custom user model & custom admin
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')}),
@synotna
synotna / FieldPermissionsMixin
Created July 15, 2015 13:01
Field permissions mixin for Django Rest Framework
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'],
@bftanase
bftanase / secure_link.php
Last active May 23, 2024 13:47
generate URL for nginx secure_link
@Anuragjain89
Anuragjain89 / master-slave-notes.rb
Last active February 6, 2023 12:22
Notes on postgres master slave configuration.
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
# -----------------------------------------------------------------------------------------------------------