sudo apt-get update
sudo apt-get install fish
sudo apt-add-repository ppa:fish-shell/release-2
sudo apt-get update
sudo apt-get install fish``
FROM elixir:latest | |
# Install debian packages | |
RUN apt-get update && \ | |
apt-get install --yes build-essential inotify-tools postgresql-client git && \ | |
apt-get clean | |
ADD . /app | |
# Install Phoenix packages |
""" | |
Single Responsibility Principle | |
“…You had one job” — Loki to Skurge in Thor: Ragnarok | |
A class should have only one job. | |
If a class has more than one responsibility, it becomes coupled. | |
A change to one responsibility results to modification of the other responsibility. | |
""" | |
class Animal: | |
def __init__(self, name: str): |
package main | |
import ( | |
"fmt" | |
) | |
type Mutator interface { | |
Change() | |
AnotherChange() | |
} |
bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic
bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000
... wait a minute ...
When you read about how to create and consume a pre-signed url on this guide, everything is really easy. You get your Postman and it works like a charm in the first run.
Then you open your browser, try your usual $.ajax() and send your PUT operation, and you hit the cold iced wall of AWS error message, a simple <Code>SignatureDoesNotMatch</Code>
that will steal hours from your productivity.
So here I come to save you and give you a free working example of how to upload a file directly to AWS S3 from your browser. You are wellcome :).
########################################## | |
# To run: | |
# curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x | |
########################################## | |
# Check that HTTPS transport is available to APT | |
if [ ! -e /usr/lib/apt/methods/https ]; then | |
sudo apt-get update | |
sudo apt-get install -y apt-transport-https | |
fi |
Object.byString = function(o, s) { | |
s = s.replace(/\[(\w+)\]/g, '.$1'); | |
s = s.replace(/^\./, ''); | |
var a = s.split('.'); | |
while (a.length) { | |
var n = a.shift(); | |
if (n in o) { | |
o = o[n]; | |
} else { | |
return; |
Escolhi tratar sobre esse assunto hoje simplesmente porque foi uma das primeiras coisas que me perguntei "como eu faço isso?" no mundo ruby. Acredito que muita gente se pergunte a mesma coisa e espero que eu possa ajudar em algo para elas. 😀
Bem, se você é um programador java, você chama sua gem de jar, se você é um programador C#, você chama de dll. Resumindo, é uma lib, uma biblioteca contendo códigos que você pode reaproveitar importando em outros projetos.
E usar gems no ruby é muito fácil, se você já deu uma brincada com rails por exemplo, é só você adicionar o código gem 'nome_da_gem'
no arquivo Gemfile
que está no root, depois executar o comando bundle install
para baixar sua gem do repositório e pronto, só sair usando a biblioteca!
require 'net/http' | |
require 'uri' | |
require 'json' | |
uri = URI('http://divulga.tse.jus.br/2014/divulgacao/oficial/143/dadosdivweb/br/br-0001-e001431-w.js') | |
class String; def percent_of(n) "#{(self.to_f / n.to_f * 100.0).round(2)}%"; end; end | |
begin | |
data = JSON(Net::HTTP.get_response(uri).body) | |
system('clear') | |
puts "\n\n----\n#{data['ht']} - #{data['ea'].percent_of(data['e'])} dos votos apurados\n----" | |
data['cand'].take(3).each do |candidate| |