Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -o pipefail
ORIGINAL_TABLE="User"
TMP_TABLE="${ORIGINAL_TABLE}-$(date +%Y%m%d%H%M%S)"
function wait_for_table_creation() {
local table_name=$1
resource "aws_cloudwatch_log_group" "sidekiq_stats" {
name = "/aws/lambda/sidekiq-stats"
retention_in_days = 7
}
resource "aws_iam_role" "sidekiq_stats" {
name = "sidekiq-stats"
assume_role_policy = data.aws_iam_policy_document.sidekiq_stats_assume_role.json
}
package main
import (
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
SELECT
"Actions Workflow" AS workflow,
SUM(Quantity) AS sum
FROM
'f1adc48a_2025-02-14_7.csv'
WHERE
Product = 'Actions'
AND Date BETWEEN '2025-02-01' AND '2025-02-14'
GROUP BY
workflow
const HotelLocation = {
Fukuoka: "Fukuoka",
Odaiba: "Odaiba",
Ariake: "Ariake",
} as const;
const locationCodeMap: LocationCode = {
[HotelLocation.Fukuoka]: "FUKHIHI",
[HotelLocation.Odaiba]: "TYOTOHI",
[HotelLocation.Ariake]: "TYOARDI",
const configs: Configs = [
{
location: HotelLocation.Odaiba,
arrivalDate: new Date("2025-03-09"),
departureDate: new Date("2025-03-10"),
},
{
location: HotelLocation.Ariake,
arrivalDate: new Date("2025-03-09"),
departureDate: new Date("2025-03-10"),
@mizzy
mizzy / send_mail.tf
Last active February 27, 2025 07:02
Send mails by Cloud Run functions
resource "google_service_account" "send_mail" {
account_id = "send-mail"
display_name = "send-mail"
}
resource "google_project_iam_member" "send_mail" {
for_each = toset([
"roles/iam.serviceAccountTokenCreator",
])
@mizzy
mizzy / main.go
Created January 28, 2025 23:33
Send mails from a service account via Gmail API
package sendMail
import (
"bytes"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"cloud.google.com/go/pubsub"
package main
import (
"fmt"
"log"
gohcl2 "github.com/hashicorp/hcl/v2/gohcl"
hcl2parse "github.com/hashicorp/hcl/v2/hclparse"
)
package main
import (
"fmt"
"io/ioutil"
"log"
"regexp"
"strings"
gohcl2 "github.com/hashicorp/hcl/v2/gohcl"