Skip to content

Instantly share code, notes, and snippets.

Andriy Tymchenko silpol

Block or report user

Report or block silpol

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
@silpol
silpol / .gitignore
Created Nov 5, 2018 — forked from starenka/.gitignore
fabfile to deploy flask app to nginx/supervisor/uwsgi stack
View .gitignore
.idea/*
*.pyc
View Install Lets Encrypt.md
@silpol
silpol / gist:57ea5d88641543d48302ff321d09ef6e
Created Nov 21, 2017 — forked from jcinis/gist:2866253
Generate a random username for Django
View gist:57ea5d88641543d48302ff321d09ef6e
from random import choice
from string import ascii_lowercase, digits
from django.contrib.auth.models import User
def generate_random_username(length=16, chars=ascii_lowercase+digits, split=4, delimiter='-'):
username = ''.join([choice(chars) for i in xrange(length)])
if split:
username = delimiter.join([username[start:start+split] for start in range(0, len(username), split)])
@silpol
silpol / gist:5bfbce862957090af3e6184675414a61
Created May 13, 2017 — forked from evildmp/gist:3094281
Set up Django, nginx and uwsgi
View gist:5bfbce862957090af3e6184675414a61

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@silpol
silpol / nda2csv.rb
Created Jan 8, 2017 — forked from terotil/nda2csv.rb
Processor for Nordea machine readable bank statements (NDA format). Functionally minimal, just enough to outline a friendly interface and be able to export main transaction records to CSV, which is further processable to OFX using https://github.com/terotil/ofxify
View nda2csv.rb
require 'date'
module Nordea
module NDA
class Record
def self.parse(str)
self.new(str).normalized
end
def initialize(str)
@silpol
silpol / nginx-uwsgi-python3
Created Jul 20, 2016 — forked from simoncoulton/nginx-uwsgi-python3
Setting up Nginx, uWSGI & Python3
View nginx-uwsgi-python3
======================================
Setting up Nginx, uWSGI and Python3
======================================
First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were:
1) Only showed you how to run the server for a single web application.
2) Only showed you how to configure the app, not the server it was running on.
My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me.
View fake_smtp.py
#!/usr/bin/env python
"""A noddy fake smtp server."""
import smtpd
import asyncore
class FakeSMTPServer(smtpd.SMTPServer):
"""A Fake smtp server"""
def __init__(*args, **kwargs):
@silpol
silpol / fabfile.py
Created Feb 2, 2016 — forked from elliottb/fabfile.py
Example Python Fabric deployment script. Deploys code from a deployment box to a remote host. Usage from command line on the deployment box: fab deploy.
View fabfile.py
from fabric.api import local, run, env, put
import os, time
# remote ssh credentials
env.hosts = ['10.1.1.25']
env.user = 'deploy'
env.password = 'XXXXXXXX' #ssh password for user
# or, specify path to server public key here:
# env.key_filename = ''
@silpol
silpol / default.conf
Last active Aug 28, 2015 — forked from woodb/default.conf
nginx configuration for uWSGI
View default.conf
server {
listen 80;
server_name blog;
server_name blog.example.com;
root /var/www/blog;
location /static/ {
alias /var/www/blog/static/;
expires 30d;
access_log off;
You can’t perform that action at this time.