Skip to content

Instantly share code, notes, and snippets.

View f4rx's full-sized avatar

Aleksey Stepanenko f4rx

View GitHub Profile
@f4rx
f4rx / Makefile
Created November 28, 2018 08:15 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@f4rx
f4rx / lxc.md
Last active August 31, 2018 12:07
LXC usage

Установка:

apt install lxc1 lxc1-templates lxc2

Темплейты расположены в /usr/share/lxc/templates/, представляют собой скрипты.

ls -l /usr/share/lxc/templates/
@f4rx
f4rx / tmux_scroll.md
Last active June 20, 2018 10:16
tmux scroll

Запусть tmux-сессию с интеграцией с iterm2

tmux -CC
# Вроде так же работает с tmux -CC attach
# Сессии потом можно смотреть в Shell -> Tmux -> Dashboard

To use your mouse in this mode (called copy mode) press ^b + : and enter following:

setw -g mouse on
@f4rx
f4rx / get_log_file_for_convert.py
Created May 31, 2018 12:09
Otus Python HW_01 log analyzator
def get_all_files_and_dirs_in_dir_and_sort(dir):
files = glob.glob(dir)
files.sort()
return files
def get_log_file_for_convert(log_dir, report_dir):
if not os.path.isdir(log_dir):
logging.info("Log dir '%s' not found" % log_dir)
return
import sys
import json
import os
import yaml
def get_message(notification):
if 'notification_type' not in notification or notification['notification_type'] != 'error':
raise SystemExit()
return notification['message']
apt update
apt -y install curl python-pip python-dev python3-dev git libxml2-dev libxslt1-dev python-openssl python3-openssl python-pyasn1 libffi-dev libssl-dev build-essential
pip install -UI pip
pip install -UI pbr setuptools pytz
pip install -UI git+https://github.com/openstack/python-openstackclient
cd /tmp/
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-headers-4.13.0-041300_4.13.0-041300.201709031731_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-headers-4.13.0-041300-generic_4.13.0-041300.201709031731_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-image-4.13.0-041300-generic_4.13.0-041300.201709031731_amd64.deb
sudo dpkg -i *.deb
@f4rx
f4rx / xo.py
Created March 14, 2018 20:32
XO
#!/bin/env python3
class Players:
def __init__(self):
self.players = {0: "X", 1: "O"}
self.player = 0
def get_player(self):
@f4rx
f4rx / reddit_post.log
Created March 3, 2018 19:42
DevOps Otus HW 25
Traceback (most recent call last):
File \"/usr/local/lib/python3.6/site-packages/urllib3/connection.py\", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File \"/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py\", line 60, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File \"/usr/local/lib/python3.6/socket.py\", line 743, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name does not resolve
During handling of the above exception, another exception occurred:
@f4rx
f4rx / cuda
Created February 16, 2018 18:02
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda