Skip to content

Instantly share code, notes, and snippets.

View sprytnyk's full-sized avatar
🪖
Fighting for the bright future of 🇺🇦

Vladyslav Krylasov sprytnyk

🪖
Fighting for the bright future of 🇺🇦
View GitHub Profile
@sprytnyk
sprytnyk / rnp.cpp
Created July 29, 2019 09:39
Pointers & references in Python & CPP (rough analogues).
#include <iostream>
using namespace std;
int main() {
// References in work.
int x(0);
int &ref = x;
x = 10;
@sprytnyk
sprytnyk / pointers_and_references.cpp
Last active July 29, 2019 09:07
Differences between pointers & references from C++ perspective.
#include <iostream>
using namespace std;
int main() {
/*
* References are often confused with pointers but three major
* differences between references and pointers are:
* - You cannot have NULL references. You must always be able to assume
* that a reference is connected to a legitimate piece of storage.
@sprytnyk
sprytnyk / .editorconfig
Created October 19, 2018 12:15
A basic edit config.
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
@sprytnyk
sprytnyk / plus.cpp
Last active June 24, 2020 22:27
Pre-increment vs post-increment in CPP.
#include <iostream>
using namespace std;
void pre_increment() {
// Pre-increment.
// i is: 1
// j is: 1
// ++i
int i(0);
[bumpversion]
current_version = 3.0.0.a0
commit = True
tag = False
files = setup.py docs/conf.py wtforms/__init__.py
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<n>\d+))?
serialize =
{major}.{minor}.{patch}.{release}{n}
{major}.{minor}.{patch}
import remote_pdb
def main():
"""
A dummy function.
"""
remote_pdb.set_trace(host='0.0.0.0', port=4444)
return True
version: '2'
services:
backend:
build: .
command: >
gunicorn -b 0.0.0.0:5005
--worker-class eventlet
--access-logfile -
--reload
@sprytnyk
sprytnyk / signal.py
Created June 14, 2018 14:56
An example of the creation of a full-fledged signal.
from blinker import Namespace
_signals = Namespace()
pre_save = _signals.signal('pre_save')
class Sender:
def __init__(self, name):
self.name = name
@sprytnyk
sprytnyk / cleanup
Last active December 20, 2018 12:08
A simple clean up helper of *.swp and *.pyc files.
#!/bin/bash
echo "### Cleaning *.pyc, *.swp and *.DS_Store files."
# Get a path from the first argument.
if [[ $* ]]; then
LOCATION=$*
else
LOCATION=$(pwd)
fi
@sprytnyk
sprytnyk / roles.py
Created November 20, 2017 15:46
Simple Flask MongoDB roles, permissions and decorator for views
import datetime
from functools import wraps
from werkzeug.security import (
generate_password_hash,
check_password_hash
)
from flask import abort