Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Alexandr Shurigin phpdude

🏠
Working from home
Block or report user

Report or block phpdude

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@phpdude
phpdude / Readme.md
Last active Jul 13, 2019
Настройка собственного VPN сервера в два клика
@phpdude
phpdude / apiblueprint.cson
Created Mar 1, 2018
API Blueprint fix for syntax highlighting in Request and extra coloring for better reading documentation files (~/.atom/packages/language-api-blueprint/grammars/apiblueprint.cson)
View apiblueprint.cson
fileTypes: [
"apib"
]
foldingStartMarker: '''
(?x)
(<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|form|dl)\\b.*?>
|<!--(?!.*-->)
|\\{\\s*($|\\?>\\s*$|//|/\\*(.*\\*/\\s*$|(?!.*?\\*/)))
)
'''
@phpdude
phpdude / vmware-ec2.md
Created Dec 20, 2017 — forked from RJ/vmware-ec2.md
Exporting VMWare images (OVA) from EC2
View vmware-ec2.md

How to provision VMWare compatible .ova images on EC2

EC2 only lets you export instances as VMWare-compatible OVA files if you originally imported that instance from an OVA. Presumably it preserves the metadata and XML gubbins for the instance, and just wraps it up again using that metadata on export.

In order to provision arbitrary VMs in an OVA-exportable way, we abuse the volume snapshots on one VM.

Prep work:

  • Make a fresh install of ubuntu server or whatever your base distro is, in VMWare, export as OVA file. (single disk only!)
  • Untar the OVA and import the VMDK file into ec2 using ec2-instance-import onto an HVM instance type (ie, no xen kernel needed)
View download.py
import os
import sys
import requests
import re
from json import loads
from HTMLParser import HTMLParser
import shutil
from lxml.html import fromstring
from time import sleep
View README.md

Simplest Async Email Backend for Django

What is this?

It is simplest email backend for Django which supports async email delivery in parallel threads. Keep it simple! It has various analogs, you can google for it yourself.

Requirements

Django async email backend requires futures library. So you need to install it with pip install futures.

@phpdude
phpdude / linux-curl-cryptopro.md
Last active Jan 25, 2017
linux curl с поддержкой КРИПТОПРО
View linux-curl-cryptopro.md

Ремарка: все тесты были на Ubuntu Server 14.04, так же все это справедливо для версии openssl >= 1.0.0. Не советую использовать эту сборку curl для всего что угодно, так как она может быть сильно хуже по возможностям стандартной, так как я компилировал утилиту всего с 1 флагом, и соответственно мог упустить уйму важных ее возможностей. Советую использовать ее как доп утилиту в папке проекта или где попало, не советую в продакшен использовать везде где попало, ну или если с головой подходить к флагам компиляции и сделать это хорошо и по настоящему, у меня такой цели не стоит, делаю на скорую руку, просто как рабочее решение.

  1. Устанавливаем openssl

    apt-get install -y openssl

  2. Настраиваем в linux curl программе (не путать с библиотеками языков типа php_curl.so, там уже сами, но принцип тот же) поддержку криптографических движков:

    GOST2001-GOST89-GOST89

@phpdude
phpdude / pre-commit
Created Apr 6, 2016 — forked from wolfhechel/pre-commit
Auto add Django migrations before commit
View pre-commit
find . -type d -name migrations -not -exec git check-ignore -q {} \; -exec git add {} \;
@phpdude
phpdude / Result.example.log
Last active Mar 17, 2016
Find used python packages list needed to be installed (or used in requirements.txt)
View Result.example.log
GcsManager
Robot
WitInterface
WitResponse
XmppReporter
cjson
cloudsql
cloudsql.beans
cloudsql.dao
cloudsql.dao.dialogdao
@phpdude
phpdude / docker-compose.yml
Created Mar 9, 2016
Docker Composer Django \w NGINX \w uWSG \w PostgreSQL In Production
View docker-compose.yml
version: '2'
services:
db:
restart: always
image: postgres
environment:
- POSTGRES_USER=project
- POSTGRES_PASSWORD=project
volumes:
@phpdude
phpdude / wkhtmltopdf.tablesplit.js
Created Jan 17, 2016 — forked from niflostancu/wkhtmltopdf.tablesplit.js
WkHtmlToPdf Table Splitting Hack
View wkhtmltopdf.tablesplit.js
/**
* WkHtmlToPdf table splitting hack.
*
* Script to automatically split multiple-pages-spanning HTML tables for PDF
* generation using webkit.
*
* To use, you must adjust pdfPage object's contents to reflect your PDF's
* page format.
* The tables you want to be automatically splitted when the page ends must
* have a class name of "splitForPrint" (can be changed).
You can’t perform that action at this time.