Skip to content

Instantly share code, notes, and snippets.

View nafanyabr's full-sized avatar

Alexander Kulikov nafanyabr

  • Russia, Bryansk
View GitHub Profile
@nafanyabr
nafanyabr / example.conf
Created November 25, 2020 13:22 — forked from hgn/example.conf
Simple Python aiohttp Server with Configuration Parsing and Logging
server_addr = "127.0.0.1"
server_port = 8888
# debug level, can be debug, error, info, ...
loglevel = "debug"
paths = {
"route_set" : "/",
"interface_get" : "/",
@nafanyabr
nafanyabr / aiohttp-server.py
Created November 23, 2020 17:09 — forked from rcarmo/aiohttp-server.py
Example: asyncio and aiohttp, handling longpoll, eventsource and websocket requests with a queue and background workers
from aiohttp import web
from threading import Thread
import asyncio
import time, uuid
loop = asyncio.get_event_loop()
def long_blocking_thing(sleep):
time.sleep(sleep)
return 42
@nafanyabr
nafanyabr / gist:cc6374ccda39b6444954bcbb1235ce47
Created July 8, 2019 08:06
vue.js filter for russian date formatting
...
Vue.filter('rudate', function (value) {
if (!value) return ''
var str = new Date(value)
return ((str.getDate() < 10) ? '0' : '') + str.getDate() + '.' + ((str.getMonth() < 9) ? '0' : '') + (str.getMonth() + 1) + '.' + str.getFullYear()
})
...
new Vue({ ..

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@nafanyabr
nafanyabr / django_deploy.md
Created February 25, 2019 09:22 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

@nafanyabr
nafanyabr / django_cheat_sheet.md
Created February 25, 2019 09:22 — forked from bradtraversy/django_cheat_sheet.md
Django command cheat sheet

Django 2.x Cheat Sheet

Creating a virtual environment

We need to create a virtual env for our app to run in: More Here Run this command in whatever folder you want to create your venv folder

python -m venv ./venv
@nafanyabr
nafanyabr / setup.md
Created November 8, 2018 18:41 — forked from developius/README.md
Set up GitHub push with SSH keys

Create a repo. Make sure there is at least one file in it (even just the README) Generate ssh key:

ssh-keygen -t rsa -C "[email protected]"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings. Test SSH key:

ssh -T [email protected]
@nafanyabr
nafanyabr / linebreak.md
Created October 5, 2018 07:11
Line breaks in markdown
Hello  (<-- two spaces)
World

Hello
World