Skip to content

Instantly share code, notes, and snippets.

View dmitriy-kiriyenko's full-sized avatar

Dmitriy Kiriyenko dmitriy-kiriyenko

View GitHub Profile
GET users
GET users/1
GET users/new
POST users/new
GET users/1/edit
POST users/1/edit
GET users/1/delete
@dmitriy-kiriyenko
dmitriy-kiriyenko / gist:ca326cebd782307bf1a4
Last active August 29, 2015 14:21
docker-machine installation

Сначала включить VT-x в Биосе

$ curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_darwin-amd64 > /usr/local/bin/docker-machine
$ chmod +x /usr/local/bin/docker-machine
$ docker-machine create --provider virtualbox dev
$ docker-machine stop dev
$ VBoxManage sharedfolder add dev -name home -hostpath /Users
$ docker-machine start dev
@dmitriy-kiriyenko
dmitriy-kiriyenko / Deployment.md
Last active August 29, 2015 14:17
Default readme

Deploy

dokku-remote

All dokku commands can be given either on remote host as dokku _command_, or from developer machine as ssh -t dokku@host.com _command_. To help with this, there is a script bin/dokku-remote that reads .dokkurc file in application root folder and executes dokku command remotedly. We highly recommend to alias it: alias dr="bin/dokku-remote". When server changes, you should change

@dmitriy-kiriyenko
dmitriy-kiriyenko / gist:f84803e1f5f211e4ebc2
Created December 25, 2014 16:28
С днём рождения!
,,,,,,
,,,,, .;;;;;;....
С днём рождения .;;;;;;;. ;;;;;;;; :::
Я люблю тебя, моя дорогая ;;;;;;;;;;. ;;;;;@;;.:::
,____ ,____ ,____ ;;;;;;;@;;; `;;;;;;':::;
/ /~\ / /~\ / /~\ `;;;;;;@;;; `;;;;'::::'
/ / \ |\_/|___ / / \ / / \ `;;;;;;;;' ;; ::::'
\ )\,."~~|/~\| \ \ )\,."~~~ ,/ \ ) `;;;;;' ` ::
~~~ / ^ ^ __," \ ~~~ / ^ ^ \ ~~~ ;; ` `
/ @ @ \ \ ) / @ @ \ ` ` `
@dmitriy-kiriyenko
dmitriy-kiriyenko / some_page.rb
Created November 28, 2014 19:51
Siteprism and Capybara finders
class SomePage < SitePrism::Page
extend XPath::HTML # gem used by Capybara
element :some_link, :xpath, link('some text') # Text, id, title, or image alt attribute of the link
element :some_other_link, :xpath, link_or_button('some text') # Same as above but both links and buttons
element :some_input, :xpath, field('some text') # any `input`, `textarea`, or `select` element that doesn't have a
# type of `submit`, `image`, or `hidden`
# by label, id, or name of the field
# for full list of options see https://github.com/jnicklas/xpath/blob/master/lib/xpath/html.rb
@dmitriy-kiriyenko
dmitriy-kiriyenko / dokku-remote.sh
Last active August 29, 2015 14:09
Dokku remote ctl script
#!/usr/bin/env bash
set -e
remote="$(git remote show $1 -n | grep Push | cut -d : -f 2)"
exec ssh -t $remote "${*:2}"
@dmitriy-kiriyenko
dmitriy-kiriyenko / gist:af280bcec479992725f4
Created October 7, 2014 20:44
Каррирование
sumTrhee :: Int -> Int -> Int -> Int
sumThree a b c = a + b + c
-- Вызов:
sumThree 1 2 3
-- Частичный вызов:
subTree 1 2
function countdown
{
local START=$(date +%s)
local END=$(date -j -f "%Y/%m/%d %H:%M:%S" "$1" +%s)
local CUR=$START
while [[ $CUR -lt $END ]]
do
CUR=$(date +%s)
LEFT=$((END-CUR))
@dmitriy-kiriyenko
dmitriy-kiriyenko / gist:3ac393539d1f52cb547d
Created August 2, 2014 05:28
A piece of solution for marathon service discovery
#!/usr/bin/env python
from kazoo import client
import sys
import time
import subprocess
zk = client.KazooClient() #we always connect to localhost
zk.start()
@client.ChildrenWatch(zk, '/marathon/state')
@dmitriy-kiriyenko
dmitriy-kiriyenko / error_stack.txt
Last active August 29, 2015 14:04
Error in cloudformation ruby dsl
/usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/cloudformation-ruby-dsl-0.4.5/bin/cfntemplate-to-ruby:307:in `simplify': no implicit conversion of FnCall into Array (TypeError)
from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/cloudformation-ruby-dsl-0.4.5/bin/cfntemplate-to-ruby:321:in `block in simplify'
from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/cloudformation-ruby-dsl-0.4.5/bin/cfntemplate-to-ruby:321:in `map'
from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/cloudformation-ruby-dsl-0.4.5/bin/cfntemplate-to-ruby:321:in `simplify'
from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/cloudformation-ruby-dsl-0.4.5/bin/cfntemplate-to-ruby:291:in `block in simplify'
from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/cloudformation-ruby-dsl-0.4.5/bin/cfntemplate-to-ruby:291:in `each'
from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/cloudformation-ruby-dsl-0.4.5/bin/cfntemplate-to-ruby:291:in `m