Skip to content

Instantly share code, notes, and snippets.

Avatar
🏀
Working from home

Vic Shóstak koddr

🏀
Working from home
View GitHub Profile
@koddr
koddr / .babelrc
Last active Jul 19, 2020
Webpack 3 config for simple Django/Flask project with Autoprefixer, PostCSS, SCSS style files, Vue.js and Babel
View .babelrc
{
"presets": ["@babel/preset-env"]
}
@koddr
koddr / Docker-Hub-README-example.md
Created Jul 13, 2020
Docker Hub README example for X project (replace to yours).
View user.go
// ...
// Create new validator
validate := utils.Validate(map[string]string{
"uuid": user.ID.String(),
"email": user.Email,
"username": user.Username,
})
// Check fields validation
View password_generator.go
package main
import (
"fmt"
"log"
"golang.org/x/crypto/bcrypt"
)
func main() {
for {
View Certbot и nginx, как обратный прокси в Docker.md

Certbot и nginx, как обратный прокси в Docker (пример с 2 react проектами)

В результате будет 2 react проекта на 1 сервере доступных по разным ссылкам

Цели

  • Запустить nginx в одном контейнере
  • Запустить другие проекты в других контейнерах
  • Научить nginx перенаправлять запросы с разных доменов на разные проекты
  • Получить ssl сертификаты для всех проектов
@koddr
koddr / benchmark+go+nginx.md
Created Nov 26, 2019 — forked from hgfischer/benchmark+go+nginx.md
Benchmarking Nginx with Go
View benchmark+go+nginx.md

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
View .zshrc
# Golang
export GOPATH="$HOME/.go"
export PATH="$PATH:$GOPATH/bin"
@koddr
koddr / get_keys_in_first_level.py
Created Apr 2, 2019
Python: JSON only get keys in first level
View get_keys_in_first_level.py
import json
string_arr = '''
{
"user": {
"code": 0,
"data": [
{
"1": {
"row": {
@koddr
koddr / Flake8.txt
Created Mar 24, 2019 — forked from tossmilestone/Flake8.txt
Flake8 integrated with PyCharm
View Flake8.txt
How to manually setup flake8 as PyCharm external tool
File / Settings / Tools / External Tools / Add
Name: Flake8
Program: $PyInterpreterDirectory$/python
Parameters: -m flake8 --max-complexity 10 --ignore E501 $FilePath$
Working directory: $ProjectFileDir$
Output Filters / Add
Name: Filter 1
@koddr
koddr / VK_API_wall_post_example.py
Last active Oct 30, 2018
VK API wall.post example (Django 1.11.x, RQ)
View VK_API_wall_post_example.py
# Import Python packages
import requests
# Import VK API
import vk
# Import Django packages
from django.contrib.sites.models import Site
from django.contrib.humanize.templatetags import humanize
# Import Django Global settings
from django.conf import settings
# Import App models
You can’t perform that action at this time.