Skip to content

Instantly share code, notes, and snippets.

View vaniakov's full-sized avatar
🇺🇦

Ivan Kovalkovskyi vaniakov

🇺🇦
  • Lohika
  • Lviv, Ukraine
View GitHub Profile
@vaniakov
vaniakov / tmux.md
Created August 10, 2018 12:19 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@vaniakov
vaniakov / custom_django_checks.py
Created July 31, 2018 19:33 — forked from hakib/custom_django_checks.py
Custom django checks using Django check framework, inspect and ast.
"""
Custom django checks.
H001: Field has no verbose name.
H002: Verbose name should use gettext.
H003: Words in verbose name must be all upper case or all lower case.
H004: Help text should use gettext.
H005: Model must define class Meta.
H006: Model has no verbose name.
H007: Model has no verbose name plural.
import sys
def get_size(obj, seen=None):
"""Recursively finds size of objects"""
size = sys.getsizeof(obj)
if seen is None:
seen = set()
obj_id = id(obj)
if obj_id in seen:
return 0
# -*- coding: utf-8 -*-
import gevent.monkey
gevent.monkey.patch_all()
import collections
import threading
import time
import random
import sys
@vaniakov
vaniakov / pytest.sh
Created December 12, 2017 10:02 — forked from amatellanes/pytest.sh
Useful py.test commands.
py.test test_sample.py --collect-only # collects information test suite
py.test test_sample.py -v # outputs verbose messages
py.test -q test_sample.py # omit filename output
python -m pytest -q test_sample.py # calling pytest through python
py.test --markers # show available markers
@vaniakov
vaniakov / udpproxy.py
Created June 18, 2017 11:35 — forked from vxgmichel/udpproxy.py
UDP proxy server using asyncio
"""UDP proxy server."""
import asyncio
class ProxyDatagramProtocol(asyncio.DatagramProtocol):
def __init__(self, remote_address):
self.remote_address = remote_address
self.remotes = {}
@vaniakov
vaniakov / ipv4.py
Created July 20, 2016 09:33 — forked from cslarsen/ipv4.py
Two small Python functions to convert IPv4 address to integer and vice-versa
#!/usr/bin/env python
"""Functions to convert IPv4 address to integer and vice-versa.
Written by Christian Stigen Larsen, http://csl.sublevel3.org
Placed in the public domain by the author, 2012-01-11
Example usage:
$ ./ipv4 192.168.0.1 3232235521
192.168.0.1 ==> 3232235521
# coding=utf-8
"""
LICENSE http://www.apache.org/licenses/LICENSE-2.0
"""
import datetime
import sys
import time
import threading
import traceback
import SocketServer
@vaniakov
vaniakov / gist:dd46ff477e473f617da9b66b314fc199
Created April 29, 2016 14:57 — forked from Atem18/gist:4696071
Tutorial to seting up a django website in production.

Set up Django, Nginx and Gunicorn in a Virtualenv controled by Supervisor

Steps with explanations to set up a server using:

  • Virtualenv
  • Virtualenvwrapper
  • Django
  • Gunicorn
import requests
from lxml import html
USERNAME = "<USERNAME>"
PASSWORD = "<PASSWORD>"
LOGIN_URL = "https://bitbucket.org/account/signin/?next=/"
URL = "https://bitbucket.org/dashboard/overview"
def main():