Skip to content

Instantly share code, notes, and snippets.

View yarkovaleksei's full-sized avatar
🏠
Working from home

Yarkov Aleksey yarkovaleksei

🏠
Working from home
  • Russia, Rostov-on-Don
View GitHub Profile
.container {
width: 100%;
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
@media (min-width: 576px) {
.container {
@yarkovaleksei
yarkovaleksei / script.sh
Created December 6, 2017 13:40 — forked from haisum/script.sh
comment and uncomment lines in bash script via sed
sed -i '/<pattern>/s/^/#/g' file #comment
sed -i '/<pattern>/s/^#//g' file #uncomment
@yarkovaleksei
yarkovaleksei / main.yml
Created December 6, 2017 07:24 — forked from evantahler/main.yml
CertBot + Ansible
# tasks/main.yml
- name: install certbot dependencies
apt: name={{ item }} state=present
with_items:
- build-essential
- libssl-dev
- libffi-dev
- python-dev
- git
class Queue {
constructor (queue = []) {
this._q = queue
}
get queue () {
return this._q.reverse()
}
push (key, val) {
@yarkovaleksei
yarkovaleksei / docker-compose-node-mongo.yml
Created November 12, 2017 16:52 — forked from wesleybliss/docker-compose-node-mongo.yml
Docker Compose with example App & Mongo
version: '2'
services:
myapp:
build: .
container_name: "myapp"
image: debian/latest
environment:
- NODE_ENV=development
- FOO=bar
volumes:
function recursive (obj, tab = '') {
let keys = []
try {
keys = Object.keys(obj)
} catch (err) {
throw new Error(err)
}
keys.forEach((key) => {
if (obj[key] !== null
&& typeof obj[key] === 'object') {
@yarkovaleksei
yarkovaleksei / tokens.md
Created August 28, 2017 00:02 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию

Token-Based Authentication(JWT)

Preconditions:

В данной заметке рассматривается работа JWT с симметичным алгоритмом шифрования (HS256/HS384/HS512)

Основы:

Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им пароля с паролем, сохранённым в базе данных пользователей;

Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.

@yarkovaleksei
yarkovaleksei / node-translit.js
Created August 27, 2017 16:30 — forked from mad-gooze/node-translit.js
Simple translit module for node.js - Простой модуль транслитерации кирилицы для node.js
module.exports = function(text) {
return text.replace(/([а-яё])|([\s_-])|([^a-z\d])/gi,
function (all, ch, space, words, i) {
if (space || words) {
return space ? '-' : '';
}
var code = ch.charCodeAt(0),
index = code == 1025 || code == 1105 ? 0 :
code > 1071 ? code - 1071 : code - 1039,
t = ['yo', 'a', 'b', 'v', 'g', 'd', 'e', 'zh',
@yarkovaleksei
yarkovaleksei / post-merge
Created August 25, 2017 12:06 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
names_file = 'names.txt'
father_names_file = 'father_names.txt'
combinations_file = 'combinations.txt'
def main():
with open(combinations_file, 'w') as combinations: