Skip to content

Instantly share code, notes, and snippets.

View smereczynski's full-sized avatar

smerek smereczynski

View GitHub Profile
@smereczynski
smereczynski / gist:10d66c35de6856d4f324
Created September 22, 2014 13:38
Contact Form 7 dropdown country list in Russian (Cyrilic)
[select* country id:country "RU|Россия" "AU|Австралия" "AT|Австрия" "AZ|Азербайджан" "AX|Аландские острова" "AL|Албания" "DZ|Алжир" "VI|Американские Виргинские острова" "AS|Американское Самоа" "AI|Ангилья" "AO|Ангола" "AD|Андорра" "AQ|Антарктида" "AG|Антигуа и Барбуда" "AR|Аргентина" "AM|Армения" "AW|Аруба" "AF|Афганистан" "BS|Багамы" "BD|Бангладеш" "BB|Барбадос" "BH|Бахрейн" "BZ|Белиз" "BY|Белоруссия" "BE|Бельгия" "BJ|Бенин" "BM|Бермуды" "BG|Болгария" "BO|Боливия" "BQ|Бонайре, Санкт-Эстатиус и Саба" "BA|Босния и Герцеговина" "BW|Ботсвана" "BR|Бразилия" "IO|Британская территория в Индийском океане" "VG|Британские Виргинские острова" "BN|Бруней" "BF|Буркина Фасо" "BI|Бурунди" "BT|Бутан" "VU|Вануату" "VA|Ватикан" "GB|Великобритания" "UK|Великобритания" "HU|Венгрия" "VE|Венесуэла" "UM|Внешние малые острова (США)" "TL|Восточный Тимор" "VN|Вьетнам" "GA|Габон" "HT|Гаити" "GY|Гайана" "GM|Гамбия" "GH|Гана" "GP|Гваделупа" "GT|Гватемала" "GN|Гвинея" "GW|Гвинея-Бисау" "DE|Германия" "GG|Гернси" "GI|Гибралтар" "HN|Гонду
@smereczynski
smereczynski / default
Last active August 29, 2015 14:14
NGINX rev proxy on Azure
## Basic reverse proxy server ##
## Apache (nginxtest2) backend for example.net.pl ##
upstream apachephp {
server 10.1.0.5:80; #Apache1
}
## Apache (nginxtest3) backend for static.example.net.pl ##
upstream apachestatic {
server 10.1.0.6:80; #Apache2
}
@smereczynski
smereczynski / commands
Created February 8, 2015 19:54
NGINX on Azure (Azure CLI xplat tool commands)
azure account affinity-group create -l 'West Europe' -e nginxtest-ag nginxtest-ag
azure network vnet create -e 10.1.0.0 -i 20 -p 10.1.0.0 -n Subnet-1 -r 24 -a nginxtest-ag nginxtest-vn
azure vm image list
azure vm create -z 'Small' -n nginxtest1 -e 22 -t myCert.pem -P -w nginxtest-vn -S 10.1.0.4 -A nginxtest-as nginxtest1 b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20150123-en-us-30GB michal
azure vm create -c -a nginxtest-ag -z 'Small' -n nginxtest2 -e 2222 -t myCert.pem -P -w nginxtest-vn -S 10.1.0.5 nginxtest1 b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20150123-en-us-30GB michal
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
@smereczynski
smereczynski / gist:e8e1e952fddbf84abefd
Last active August 29, 2015 14:22
Ansible simple playbook for NGINX
---
- hosts: webservers
tasks:
- name: Installs nginx web server
apt: pkg=nginx state=installed update_cache=true
notify:
- start nginx
handlers:
- name: start nginx
from azure.mgmt.monitor import MonitorManagementClient
from azure.mgmt.monitor.models import AlertRuleResource, RuleEmailAction, ThresholdRuleCondition, \
RuleMetricDataSource, ConditionOperator, TimeAggregationOperator
subscription_id = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
credentials = ServicePrincipalCredentials(
client_id='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
secret='xxxxxxxxxxxxxxxxxxxxxxx',
from azure.mgmt.monitor.models import RuleMetricDataSource, ThresholdRuleCondition, RuleEmailAction
def storage_blob_90_success(resource_id, resource_name, group_name):
data_source = RuleMetricDataSource(
resource_uri=resource_id,
metric_name='PercentSuccess'
)
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/trusty64'
default: URL: https://vagrantcloud.com/ubuntu/trusty64
==> default: Adding box 'ubuntu/trusty64' (v20171019.0.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/20171019.0.0/providers/virtualbox.box
==> default: Successfully added box 'ubuntu/trusty64' (v20171019.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/trusty64'...
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.resource import ResourceManagementClient
import os
import keyring.backend
from keyrings.alt.file import PlaintextKeyring
keyring.set_keyring(PlaintextKeyring())
TENANT_ID = os.getenv('TENANT_ID')
CLIENT = os.getenv('CLIENT')
FROM python:3.6
RUN pip install azure keyrings.alt