Skip to content

Instantly share code, notes, and snippets.

View vilisov's full-sized avatar

Stas Vilisov vilisov

View GitHub Profile
@vilisov
vilisov / update-font-family.py
Last active April 10, 2024 07:54
Change the font family for a font
#!/usr/bin/env python3
# ==========================================================================
# Dependencies:
# 1) Python 3.6+ interpreter
# 2) fonttools Python library (https://github.com/fonttools/fonttools)
# - install with `pip3 install fonttools`
#
# Usage:
# python3 update-font-family.py [FONT FAMILY NAME] [FONT PATH 1] <FONT PATH ...>
from __future__ import unicode_literals
from urllib import urlencode
import requests
from purl import URL
from django.conf import settings
@vilisov
vilisov / nginx.conf
Last active December 10, 2016 00:04
project files
server {
listen 80;
server_name project-name.com;
charset utf-8;
client_max_body_size 512m;
location /static/ {
alias /home/webmaster/apps/project_name/public/static/;
}
@vilisov
vilisov / install.sh
Last active June 2, 2016 08:05
fuse s3fs
yum remove fuse fuse-devel fuse-s3fs
yum install gcc libstdc++-devel gcc-c++ curl-devel libxml2-devel openssl-devel mailcap
cd /usr/src/
wget https://github.com/libfuse/libfuse/releases/download/fuse-2.9.6/fuse-2.9.6.tar.gz
tar xzf fuse-2.9.6.tar.gz
cd fuse-2.9.6
./configure --prefix=/usr/local
make && make install
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
ldconfig
@vilisov
vilisov / policy.json
Last active May 30, 2016 15:08
S3 bucket readonly policy
{
"Version": "2008-10-17",
"Id": "http better policy",
"Statement": [
{
"Sid": "readonly policy",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::media.example.com/*"
@vilisov
vilisov / comands.sh
Last active November 23, 2015 09:01
centos ru locale
touch /etc/sysconfig/i18n
nano /etc/sysconfig/i18n
LANG="ru_RU.UTF-8"
SUPPORTED="ru_RU.UTF-8:ru_RU:ru"
SYSFONT="latarcyrheb-sun16"
~/.bashrc
export LC_ALL=en_US.UTF-8
export LANG=ru_RU.UTF-8
@vilisov
vilisov / comands.sh
Last active May 9, 2020 12:00
centos 7 python 3
cd /tmp
yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel wget python-devel libxml2 libxml2-devel libxslt libxslt-devel python-pip libtiff-devel libjpeg-devel libzip-devel freetype-devel lcms2-devel libwebp-devel tcl-devel tk-devel htop
wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz
tar xf Python-3.8.2.tgz
cd Python-3.8.2
./configure --prefix=/usr/local --enable-shared
make
make install
touch /etc/ld.so.conf.d/local.conf
@vilisov
vilisov / nginx.conf
Last active February 15, 2016 09:31
nginx.conf and supervisord.conf
user webmaster;
worker_processes 1;
error_log /home/webmaster/logs/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 2048;
@vilisov
vilisov / hamming_code.py
Last active February 26, 2023 15:51
Алгоритм Хэмминга (Python)
import random
# длина блока кодирования
CHUNK_LENGTH = 8
# проверка длины блока
assert not CHUNK_LENGTH % 8, 'Длина блока должна быть кратна 8'
# вычисление контрольных бит
CHECK_BITS = [i for i in range(1, CHUNK_LENGTH + 1) if not i & (i - 1)]
@vilisov
vilisov / nginx.conf
Last active August 29, 2015 14:16
supervisor.conf and nginx.conf for cdn server
user webmaster;
worker_processes 1;
daemon off;
error_log /home/webmaster/logs/nginx/error.log;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}