Skip to content

Instantly share code, notes, and snippets.

Avatar

Jessiel Heitor Hacke jessiel-hacke

  • Currently at Shopify
  • Raleigh, North Carolina
View GitHub Profile
View backup.config
##############################
## POSTGRESQL BACKUP CONFIG ##
##############################
# Optional system user to run backups as. If the user the script is running as doesn't match this
# the script terminates. Leave blank to skip check.
BACKUP_USER=postgres
# Optional hostname to adhere to pg_hba policies. Will default to "localhost" if none specified.
HOSTNAME=localhost
View backup.config
##############################
## POSTGRESQL BACKUP CONFIG ##
##############################
# Optional system user to run backups as. If the user the script is running as doesn't match this
# the script terminates. Leave blank to skip check.
BACKUP_USER=postgres
# Optional hostname to adhere to pg_hba policies. Will default to "localhost" if none specified.
HOSTNAME=localhost
View test
require 'date'
require 'set'
def normalize_requests(requests)
start_work = DateTime.strptime('8', '%H').to_time
end_work = DateTime.strptime('17', '%H').to_time
requests = requests.map do |c|
c = c.split(',')
tp = [DateTime.strptime(c.first, '%H:%M%P').to_time, c.last.strip.to_i]
@jessiel-hacke
jessiel-hacke / flatten_alternatives
Created Dec 20, 2016
Benchmark flatten alternatives
View flatten_alternatives
# methods defined on main:Object
def iron(array)
a = []
array.each do |element|
if element.is_a? Array
a.push(*iron(element))
else
a.append(element)
end
end