This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat ./id_rsa.pub | ssh -p 29418 styx.mp@192.168.11.11 gerrit create-account --ssh-key - jenkins --full-name "Leeroy\ Jenkins" --email jenkins@domain.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www-data; | |
worker_processes 4; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule FibAgent do | |
defstruct cache: nil, highest_n: 0 | |
def start_link do | |
initial_cache = Enum.into([ {0, 0}, {1, 1}], HashDict.new) | |
state = %__MODULE__{cache: initial_cache, highest_n: 1} | |
Agent.start_link(fn -> state end, name: __MODULE__) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
augroup elixir | |
au! | |
au BufNewFile,BufRead *.ex,*.exs noremap <buffer> <leader>t :!mix test %<cr> | |
au BufNewFile,BufRead *_test.exs noremap <buffer> <leader>t :!mix test %<cr> | |
augroup END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule FibAgent do | |
def start_link do | |
cache = Enum.into([{0, 0}, {1, 1}], HashDict.new) | |
Agent.start_link(fn -> cache end) | |
end | |
def fib(pid, n) when n >= 0 do | |
Agent.get_and_update(pid, &do_fib(&1, n)) | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BROWSER='google-chrome' | |
#GITLAB_SECRET='' | |
ENDPOINT='http://gitlab.activeby.net/api/v3' | |
PROJECT='activebilling/core' | |
#curl --header "PRIVATE-TOKEN: xxx" "http://gitlab.activeby.net/api/v3/projects/activebilling%2Fcore" | awk '{match($1,"[0-9]+",a)}END{print a[0]}' | |
PROJECT_ID=177 | |
ACTION="projects/$PROJECT_ID/merge_requests" | |
CURRENT_BRANCH=`git branch | grep '^\*' | awk '{ print $2; }'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def self.foo | |
"foo" | |
end | |
def foo | |
"ifoo" | |
end | |
def true_foo | |
Foo.foo | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def select_from_chosen(item_text, options) | |
field = find_field(options[:from]) | |
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()") | |
page.execute_script("$('##{field[:id]}').val('#{option_value}')") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule HttpRequester do | |
use GenServer.Behaviour | |
def start_link(_) do | |
:gen_server.start_link(__MODULE__, nil, []) | |
end | |
def fetch(server, url) do | |
:gen_server.cast(server, {:fetch, url}) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |