# list of all images on your system
$ docker images
# run a command on image busybox
$ docker run busybox echo "hello from busybox"
# shows containers that are currently running
docker ps
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
# Script for https://app.dataannotation.tech/workers/starter_assessment_complete | |
# Instructions: https://github.com/altherlex/firekamp/blob/main/app/assets/dataannotation-assessment.png | |
# File: https://github.com/altherlex/firekamp/blob/main/app/assets/coding_qual_input.txt | |
def create_staircase(nums): | |
step = 1 | |
subsets = [] | |
while len(nums) != 0: | |
if len(nums) >= step: | |
subsets.append(nums[0:step]) |
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
seconds = Benchmark.realtime do | |
counted_links = {} | |
links.each { |e| counted_links[e] = links.count(e) if counted_links[e].nil?} | |
end | |
seconds |
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
# Create tunnel gateway | |
$ ssh -L 3306:staging-bastion:3306 tunnel@staging-bastion | |
# Check the port | |
$ nc -z localhost 3306 | |
# Dump via tunnel | |
$ mysqldump -P 3306 -ualther -p '9E@EeM#C)(Ip$n%9Cy6EIr}QyD!ZbFd' staging_myhi > staging_myhi.sql -h staging-myhi.csqfg2d4yaps.ca-central-1.rds.amazonaws.co | |
# - with gzip |
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 datetime import date | |
nome=input('Qual é o seu nome? ') | |
print(f"Olá, {nome}! Prazer em te conhecer!") | |
dia=input('Qual é o dia do seu nascimento? ') | |
mes=input('Qual o mês? ') | |
ano=input('E o ano? ') | |
int_ano = int(ano) |
Show me your biggest code done in one line only.
lib['data'].select{|i| i['cover']['src'].nil? and images.find{|img| img[:q] == i['title']+' '+i['author']}}.each_with_index{|v, i| lib['data'].find{|l| l['book_id'] == v['book_id']}['cover'] = get_it.call(images.find{|img| img[:q] == v['title']+' '+v['author']}[:id]) }
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
# module WarningHandlers | |
# module Rails | |
# class Deprecation < StandardError; end | |
# def self.register_deprecation_handler | |
# ActiveSupport::Notifications.subscribe('deprecation.rails') do |_name, _start, _finish, _id, payload| | |
# exception = Deprecation.new(payload[:message]) | |
# Bugsnag.notify(exception) do |report| | |
# report.severity = 'warning' |
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 -eu | |
# | |
# Usage: | |
# $ cd $app_repo | |
# $ $infra_repo/myhi/deploy/ebbundle | |
# | |
# TODO: if branch == production, store an extra copy of the artifact (with the assets) in S3 | |
# TODO: lifecycle for this | |
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
# ---- My personal env ----- | |
export PATH="$HOME/.rbenv/bin:$PATH" | |
eval "$(rbenv init - zsh)" | |
# starts Mysql | |
[ $(mysql.server status|awk '{ print $1}') != 'SUCCESS!' ] && mysql.server start | |
alias s='subl' | |
alias ll='ls -lah' |
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
$ git update-index --no-assume-unchanged .gitignore Gemfile Gemfile.lock | |
$ git update-index --assume-unchanged .gitignore Gemfile Gemfile.lock | |
$ mysqldump -u username -R oldDbName > oldDbName.sql | |
$ mysqladmin -u username create newDbName | |
$ mysql -u username newDbName < oldDbName.sql | |
# No ruby output during rspec | |
$ RUBYOPT="-W0" bundle exec rspec spec --exclude-pattern "spec/system/**/*.rb" --force-colour |
NewerOlder