- c5.xlarge AWS instance: 4 CPUs, 8 GB RAM
- Ubuntu 18.04
- Go 1.12
- Python 2.7
- Vips 8.7.4
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 User < ActiveRecord::Base | |
attr_accessible :name, :email | |
validates :name, presence: true, length: { maximum: 50 } | |
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i | |
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX } | |
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
Show hidden characters
{ | |
"cmd": ["javac \"$file_name\" && java \"$file_base_name\""], | |
"shell": true, | |
"file_regex": "^(...*?):([0-9]*):?([0-9]*)", | |
"selector": "source.java" | |
} |
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
/* | |
Change MOAI_BIN environment for the directory where your have MoaiSDK bin | |
*/ | |
{ | |
"cmd": ["./run.sh"], | |
"working_dir": "${project_path:${folder}}", | |
"env": { | |
"MOAI_BIN": "/Users/jfcalvo/Development/moai-sdk/bin/osx/moai" | |
}, | |
"selector": "source.lua" |
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
/* | |
Useful to build simple C files. Compile the source file and run Terminal executing the | |
binary application. | |
*/ | |
{ | |
"cmd": "gcc \"$file_name\" -o \"$file_base_name\" && open -a Terminal.app \"$file_path/$file_base_name\"", | |
"shell": true, | |
"selector": "source.c" | |
} |
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 'digest' | |
# Get SHA256 Hash of a file | |
puts Digest::SHA256.hexdigest File.read "data.dat" | |
# Get MD5 Hash of a file | |
puts Digest::MD5.hexdigest File.read "data.dat" | |
# Get MD5 Hash of a string | |
puts Digest::SHA256.hexdigest "Hello World" | |
# Get SHA256 Hash of a string using update |
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
[1, 2, 3, 4].each_with_index.inject(0) do | memo, (number, i) | | |
puts "number: #{number}, i: #{i}." | |
puts "memo: #{memo}." | |
memo += number | |
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
# 54.73 seconds generating 10.000.000 chromosomes | |
def generate_chromosome_1(length, alleles) | |
(1..length).collect { alleles[rand(alleles.size)] }.join | |
end | |
# 49.15 seconds generating 10.000.000 chromosomes | |
def generate_chromosome_2(length, alleles) | |
chromosome = String.new | |
for i in 1..length |