Skip to content

Instantly share code, notes, and snippets.

View mpugach's full-sized avatar

Maksym Pugach mpugach

View GitHub Profile
@mpugach
mpugach / OTP
Created February 26, 2019 14:56 — forked from maierru/OTP
Phoenix (elixir) highload optimization
# Move erts IO Polling to dedicated threads
# https://github.com/erlang/otp/pull/1552
@mpugach
mpugach / observer.md
Created April 28, 2018 14:10 — forked from pnc/observer.md
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
@mpugach
mpugach / logrotate.d-docker
Last active December 7, 2016 04:57 — forked from chernjie/logrotate.d-docker
Logrotate docker logs, copy this file to /etc/logrotate.d/docker
/var/lib/docker/containers/*/*-json.log {
size 1Mb
daily
rotate 31
dateext
compress
missingok
notifempty
copytruncate
}
@mpugach
mpugach / webpack.config.js
Created May 8, 2016 10:59 — forked from learncodeacademy/webpack.config.js
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@mpugach
mpugach / index.md
Last active May 3, 2016 13:31 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User
$ rails g model Product name quantity:integer

Field Type List:

  • integer
  • primary_key
@mpugach
mpugach / ar_migrate.rb
Created October 26, 2015 09:51 — forked from icyleaf/ar_migrate.rb
ActiveRecord type of integer (tinyint, smallint, mediumint, int, bigint)
# activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb
# Maps logical Rails types to MySQL-specific data types.
def type_to_sql(type, limit = nil, precision = nil, scale = nil)
return super unless type.to_s == 'integer'
case limit
when 1; 'tinyint'
when 2; 'smallint'
when 3; 'mediumint'
when nil, 4, 11; 'int(11)' # compatibility with MySQL default

TL;DR

sudo pg_dropcluster 9.4 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@mpugach
mpugach / protips.js
Last active August 29, 2015 14:23 — forked from nolanlawson/protips.js
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
// create an index with an analyzer "myindex"
curl -X PUT localhost:9200/myindex -d '
{
"settings" : {`
"index":{
"number_of_replicas":0,
"number_of_shards":1,
"analysis":{
"analyzer":{
"first":{