Skip to content

Instantly share code, notes, and snippets.

View ernado's full-sized avatar

Aleksandr Razumov ernado

View GitHub Profile
@ernado
ernado / readme.md
Last active May 28, 2018 07:47 — forked from 6/readme.md
Batch-update Heroku dataclip databases using js console in 2018

If you have many dataclips pointing to a database, and upgrade that database to a different plan, those dataclips will continue pointing to the old database. This will show you how to update all of those dataclips to point to the new database.

Step 1. Log in to Heroku

Step 2. Find heroku_id for each databases

@ernado
ernado / expiration.go
Last active December 1, 2017 16:30
Card Expiration Parsing PD-2814
// Expiration wraps month and year of card expiration.
type Expiration struct {
Month time.Month
Year int
}
// LocalDate returns LocalDate that is equal to expiration date.
func (e Expiration) LocalDate() LocalDate {
return Date(e.Year, e.Month, 1)
}
@ernado
ernado / keybase.md
Created October 18, 2017 13:25
keybase.md

Keybase proof

I hereby claim:

  • I am ernado on github.
  • I am ernado (https://keybase.io/ernado) on keybase.
  • I have a public key ASARBP3wjIuhAayj8vgiZl44cadDoOyB13zemBnIVs9Mywo

To claim this, I am signing this object:

@ernado
ernado / ubuntu-install.md
Last active October 27, 2017 15:27
Ubuntu 16.04 initial installation handbook

Server install handbook

First of all

sudo apt install htop nano bash-completion man software-properties-common

Adding user

adduser ernado
@ernado
ernado / golang.sh
Created May 10, 2016 10:58
/etc/profile.d/golang.sh
#!/bin/bash
# sets envs for golang
if [ -z "$GOPATH" ]; then
export GOROOT="/usr/local/go"
export GOPATH="/go"
export PATH="$PATH:$GOPATH/bin:$GOROOT/bin"
fi
kernel.shmmax = 8000234752 // Это для PostgreSQL, чтоб можно было выставлять большой shared_buffers (6 - 8GB)
fs.file-max = 99999999 // Это для Nginx, без него можно получить "Too many open files"
net.ipv4.tcp_max_syn_backlog=524288 // Максимальное число запоминаемых запросов на соединение
net.ipv4.tcp_max_orphans=262144 // Максимальное число допустимых в системе сокетов TCP
net.core.somaxconn=65535 // Максимальное число открытых сокетов
net.ipv4.tcp_mem=1572864 1835008 2097152 // Потребление памяти для протокола TCP
net.ipv4.tcp_rmem=4096 16384 16777216 // Размер приемного буфера сокетов TCP
net.ipv4.tcp_wmem=4096 32768 16777216 // Количество памяти, резервируемой для буферов передачи сокета TCP
@ernado
ernado / System Design.md
Last active April 15, 2021 10:17 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@ernado
ernado / Makefile
Last active September 15, 2018 10:40
Makefile for gb golang project including gometalinter and goling
export GOPATH := $(shell gb env | grep GB_SRC_PATH | sed -r "s/\/(\w+)\/src/\/\1/g" | sed -r "s:GB_SRC_PATH=|\"::g")
all: format check build test info
test:
gb test
format:
go fmt .
goimports -w .
build:
gb build
check: format
@ernado
ernado / monstro.go
Last active February 3, 2016 17:23
package main
import (
"database/sql"
"fmt"
"log"
"net/http"
"strconv"
"time"
(admin)➜ tera-online.ru git:(master) pip install django-redis==3.5
Downloading/unpacking django-redis==3.5
Downloading django-redis-3.5.0.tar.gz
Running setup.py (path:/env/admin/build/django-redis/setup.py) egg_info for package django-redis
warning: no files found matching 'redis_cache/stats/templates/redis_cache/*.html'
warning: no files found matching 'redis_cache/stats/static/redis_cache/*'
Downloading/unpacking redis>=2.7.0 (from django-redis==3.5)
Downloading redis-2.10.3.tar.gz (86kB): 86kB downloaded
Running setup.py (path:/env/admin/build/redis/setup.py) egg_info for package redis