Skip to content

Instantly share code, notes, and snippets.

# Syabro's Oh My Zsh Theme for servers
#
# Install:
# curl -o ~/.oh-my-zsh/themes/syabro.zsh-theme "https://gist.githubusercontent.com/syabro/f0b1997e75998cc54067dd4e2cc59412/raw" && sed -i 's/^ZSH_THEME=".*"/ZSH_THEME="syabro"/' ~/.zshrc && source ~/.zshrc
#
# colors: https://www.ditig.com/256-colors-cheat-sheet
local red='%{%f%b%F{208}%B%}'
local white='%{%f%b%F{white}%B%}'
[tool.poetry]
name = "api"
version = "0.1.0"
description = ""
authors = ["Maxim Syabro <maxim@syabro.com>"]
[tool.poetry.dependencies]
python = "*"
django = "^2.1"
requests = "^2.19"
@syabro
syabro / gist:4252c6b478418e0b7e1b47aa17a1f76d
Last active December 8, 2017 11:19
React Design Kits
alfabank.ru
https://alfa-laboratory.github.io/arui-feather/styleguide/#themeprovider
BluePrint
http://blueprintjs.com/
# ../nginx-push-stream-module required to be download
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-threads -
@syabro
syabro / .eslintrc.json
Created May 13, 2016 16:46
.eslintrc.json
{
"extends": "airbnb",
"plugins": [
"react"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module",
"ecmaFeatures": {
@syabro
syabro / remove_stale_branches.sh
Created February 22, 2016 12:33
Remove stale branches
git fetch -p; for branch in `git branch -vv | grep ': gone]' | gawk '{print $1}'`; do git branch -d $branch; done
@syabro
syabro / backup_to_s3.sh
Created November 30, 2015 12:12
Backup to s3
#!/bin/bash
# Setup
PROJECTS=“project1 project2"
AWS_BUCKET_NAME=...
export PGUSER=django
export PGPASSWORD=django
# Perform backup routines
for PROJECT in $PROJECTS;
@syabro
syabro / restore_db.sh
Last active January 31, 2023 13:34
Load remote db to local one
#!/bin/bash
echo "Dumping $1 to /tmp/$1.pgdump..."
ssh user@host.com "pg_dump -U www-data -Fc -O $1" > /tmp/$1.pgdump
echo "Destroying current DB...";
psql template1 -c "drop database if exists localdb;" > /dev/null
echo "Creating DB...";
psql template1 -c "create database localdb" > /dev/null
ssl_stapling on;
ssl on;
ssl_certificate /etc/nginx/ssl/bundle.crt;
ssl_certificate_key /etc/nginx/ssl/private/server.key;
ssl_session_timeout 24h;
ssl_session_cache shared:SSL:2m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_
@syabro
syabro / test_migrations_conflicts.py
Last active August 29, 2015 14:25
Testcase for testing migrations conflicts
"""
To speedup tests many developers disables migrations in tests
F.e.
apps = [app.split('.')[-1] for app in INSTALLED_APPS]
MIGRATION_MODULES = {app: "%s.skip_migrations" % app for app in apps}
But bad thing about it that migrations aren't being tested for conflicts
until we run manage.py migrations
This testcase solves it.
"""