This file contains hidden or 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
| const BOM = '\ufffe' //LE. for BE '\ufeff' | |
| func createFile(name string) error { | |
| var bytes [2]byte | |
| data := `test string UTF-8` | |
| file, err := os.Create(name) | |
| if err != nil { | |
| fmt.Errorf("Can't open file. %v", err) | |
| return err |
This file contains hidden or 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 hidden or 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 hidden or 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
| # Best O(1) | |
| # Worst O(long n) | |
| arr = [1,2,3,4,5,6,7,10] | |
| def bs (list, elem) | |
| low = 0 | |
| high = list.length | |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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()) |