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 'aws-sdk' | |
require 'json' | |
creds = JSON.load(File.read('creds.json')) | |
creds = Aws::Credentials.new(creds['AccessKeyId'], creds['SecretAccessKey']) | |
ec2 = Aws::EC2::Client.new(region:'us-west-1',credentials:creds) | |
instance_ids = [] | |
ec2.describe_instances['reservations'].each do |reservation| |
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 'aws-sdk' | |
require 'json' | |
creds = JSON.load(File.read('creds.json')) | |
creds = Aws::Credentials.new(creds['AccessKeyId'], creds['SecretAccessKey']) | |
ec2 = Aws::EC2::Resource.new(region:'us-west-1',credentials:creds) | |
ec2.instances.each do |instance| | |
puts "ID: #{instance.instance_id} State: #{instance.state.name} Hostname: #{instance.public_dns_name}" |
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
using Toybox.Application as App; | |
using Toybox.WatchUi as Ui; | |
using Toybox.Graphics as Gfx; | |
class WaypointsApp extends App.AppBase { | |
function initialize() { | |
AppBase.initialize(); | |
} |
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
public class TaxCalculatorTest { | |
@Test | |
public void shouldCalculateCaliforniaTaxOnOrderWithSingleItem() { | |
var singleItemOrder = Order.withItems(Item.withCost(50)).withCustomerLocation('CA'); | |
var tax = TaxCalculator.calculate(singleItemOrder); | |
assertThat(tax).isEqualTo(3.625); | |
} | |
@Test |
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
@SpringBootTest | |
public class PaymentServiceTest { | |
@Autowired | |
private RestTemplate restTemplate; | |
@Test | |
public void shouldProcessPaymentForValidOrder() { | |
var validOrder = Order | |
.withCustomerId(123) |
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
@SpringBootTest | |
@EmbeddedKafka(topics = {"orders", "payments"}) | |
public class PaymentServiceTest { | |
@Autowired | |
private Producer<Order> orderProducer; | |
@Autowired | |
private Consumer<Payment> paymentConsumer; | |
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
public class OrderProcessingTest { | |
@Autowired | |
RestTemplate restTemplate; | |
@Test | |
public void shouldProcessValidOrder() { | |
var validOrder = Order.withItems(Item.id("2fa2ac")).withCustomerId("123"); | |
// submit Order |
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
public class OrderProcessingTest { | |
@Autowired | |
RestTemplate restTemplate; | |
@Test | |
public void shouldProcessValidOrder() { | |
var validOrder = Order.withItems(Item.id("2fa2ac")).withCustomerId("123"); | |
// submit Order |
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
ZSH_THEME="clean" | |
plugins=(git) | |
alias venv="python3 -m venv .venv && source .venv/bin/activate" | |
source ~/.oh-my-zsh/oh-my-zsh.sh |
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
props = load_props() | |
connect_to_wifi(props['wifi_sid'], props['wifi_pass']) | |
mqtt = MQTT(props['client_id'], props['iot_endpoint'], props['iot_topic']) | |
thermistor = Thermistor() | |
while True: | |
temp = thermistor.get_temp() | |
mqtt.send({'temp': temp}) | |
deep_sleep_seconds(props['sleep_seconds']) |
OlderNewer