flowchart LR
1 --> 2
2 --> 3
3 --> 4
4 --> 5
5 --> 6
6 --> 7
7 --> 8
8 --> 9
flowchart LR
9 --> 10
1 --> 12
subgraph A
5 --> 10
10 --> 11
end
subgraph B
6 --> 7
sequenceDiagram
participant 1
participant 2
participant 3
participant 4
participant 5
participant 6
participant 7
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 | |
# Get a list of instance IDs | |
instance_ids=$(aws ec2 describe-instances --profile $account --region $region --query 'Reservations[*].Instances[?State.Name==`running`].InstanceId' --output text) | |
# Loop through the instance IDs and print relevant information | |
echo "Num instances: $(echo "$instance_ids" | grep -c .)" | |
for instance_id in $instance_ids; do | |
echo "Instance ID: $instance_id" | |
# Run a command to check if Python is installed |
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 dep org.typelevel::cats-effect::3.5.2 | |
import cats.data.EitherT | |
import cats.effect.IO | |
import cats.effect.unsafe.implicits.global | |
// TODO: implement class | |
//class TypedIO[E,A](io: IO[Either[E,A]]): | |
// def unsafeRunSync(): Unit = ??? | |
//end TypedIO |
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
trait Maker[A] { | |
def make(s: String): A | |
} | |
object Maker { | |
implicit val intMaker = new Maker[Int] { | |
def make(s: String) = s.toInt | |
} | |
implicit val doubleMaker = new Maker[Double] { | |
def make(s: String) = s.toDouble |
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
// See https://docs.scala-lang.org/scala3/book/ca-type-classes.html | |
object TypeClassExample extends App: | |
// 1. Type class | |
trait Showable[A]: | |
extension (a: A) | |
def show: String | |
def format: String |
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
//--------------------------------------------------------------------------------- | |
// Utilities.gs | |
//--------------------------------------------------------------------------------- | |
const envVar = (name) => { | |
return PropertiesService.getScriptProperties().getProperty(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
# Credit to Michael Jacobson and John Duffell | |
function getGmail() { | |
const query = `from:no-reply@sns.amazonaws.com NOT label:done`; | |
let threads = GmailApp.search(query); | |
let label = GmailApp.getUserLabelByName('done'); | |
if (!label) {label = GmailApp.createLabel('done')} | |
let messages = []; | |
threads.forEach(thread => { |
NewerOlder