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 sum_digits digit | |
if digit < 10 | |
digit | |
else | |
(digit % 10) + (digit / 10).to_f | |
end | |
end | |
def validate number | |
number = number.to_s.reverse.to_i |
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
graph = {} | |
graph['start'] = Hash.new | |
graph['start']['a'] = 6 | |
graph['start']['b'] = 2 | |
graph['a'] = Hash.new | |
graph['a']['fin'] = 1 | |
graph['b'] = Hash.new | |
graph['b']['a'] = 3 | |
graph['b']['fin'] = 5 |
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
arr = [9,81,-9,3,0,12,-10] | |
def find_min(list) | |
min = list[0] | |
index = 0 | |
list.each_with_index do |val, i| | |
if val < min | |
min = val | |
index = i | |
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
require "serverspec" | |
require "docker" | |
package = ['rake', 'pg'] | |
describe "Dockerfile" do | |
before(:all) do | |
@image = Docker::Image.build_from_dir('.', {'dockerfile'=>'Dockerfile'}) | |
@image.tag(repo: 'image-test', tag: 'latest'). |
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 check(arr) | |
counter = 0 | |
arr.each do |key| | |
if key == '(' | |
counter += 1 | |
else | |
counter -= 1 | |
end | |
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
echo "##teamcity[addBuildTag '%build%']" |
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
config.vm.provision "shell", inline: <<-SHELL | |
sudo apt-get update | |
sudo apt-get install -y software-properties-common | |
sudo apt-add-repository ppa:ansible/ansible | |
sudo apt-get update | |
sudo apt-get install -y ansible zip unzip | |
SHELL |
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
ALTER SYSTEM SET fixed_date = ‘2009-07-14-10:00:00?; | |
To unset: | |
ALTER SYSTEM SET FIXED_DATE=NONE; |
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
- hosts: host1 | |
vars: | |
# created with: | |
# python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.using(rounds=1000).hash(getpass.getpass())" | |
password: "$6$rounds=1000$7dsUf2EPFiC7m4FV$RM9lxRRaannAAmOfRbjvk9V8OSENyFxBaMkOFnIvjeECw39QLCXfFvJlRqGhypDjG8RKOjwp1ufJJD3JZSpu2." | |
user: "test_user" | |
tasks: | |
- name: "Create group" | |
group: |
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
from passlib.hash | |
import sha512_crypt; | |
import getpass; | |
print sha512_crypt.using(rounds=1000).hash(getpass.getpass()) |