Dockerで検証用のNFSサーバをさくっと起動する方法
$ mkdir -p /opt/nfs
$ echo 'Hello!' > /opt/nfs/hello.txt
import { Octokit } from "@octokit/rest"; // Required: `npm install @octokit/rest --save` | |
const octokit = new Octokit({ | |
auth: "github_pat_xxxxx", // Specify your personal access token here | |
}); | |
const response = await octokit.request( | |
"GET /repos/__OWNER__/__REPO__/pulls/comments", | |
{ | |
owner: "__OWNER__", |
import pandas as pd | |
# Query of BigQuery | |
bq_query = """ | |
SELECT | |
project.id | |
, SUM(COALESCE((SELECT SUM(x.amount) FROM UNNEST(credits) x), 0) + cost) as cost | |
, SUM(cost) as raw_cost | |
, SUM(COALESCE((SELECT SUM(x.amount) FROM UNNEST(credits) x), 0)) AS credits_amount | |
FROM |
import boto3 | |
# 定数 | |
s3_bucket_name = "__BUCKET_NAME__" | |
s3_object_key = "__FILE_NAME__.csv" | |
aws_access_key_id = "XXXXXXXXXXXXXXXXXXXX" | |
aws_secret_access_key = "XXXXXXXXXXXXXXXXXXXX" | |
# AWS/S3準備 | |
aws_session = boto3.session.Session( |
import smtplib | |
from email.message import EmailMessage | |
textfile = 'textfile' | |
with open(textfile) as fp: | |
msg = EmailMessage() | |
msg.set_content(fp.read()) | |
msg['Subject'] = f'The contents of {textfile}' |
func main() { | |
someValue := 1111 | |
// 値渡し | |
passAsValue(someValue) | |
fmt.Println(someValue) // 1111 (変わらない) | |
// 参照渡し | |
passAsReference(&someValue) | |
fmt.Println(someValue) // 2222 (変わった!) |
$ docker pull amazon/aws-cli:2.7.33
$ alias aws_2.7='docker run --rm -it -v ~/.aws:/root/.aws amazon/aws-cli:2.7.33'
$ aws_2.7 --version
# For Linux/macOS | |
docker run -it --rm --volume $PWD:/opt/pwd ubuntu:latest /bin/bash | |
# For Windows (PowerShell) | |
docker run -it --rm --volume ${PWD}:/opt/pwd ubuntu:latest /bin/bash | |
# To be anable to cURL | |
apt-get update && apt-get install -y curl | |
# To be anable to ssh | |
apt-get update && apt-get install -y openssh-server |
const axios = require('axios'); | |
const slackUrl = 'https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX'; | |
exports.notifyBudgetAlert = (event, context) => { | |
if (event.data) { | |
const data = JSON.parse(Buffer.from(event.data, 'base64').toString()); | |
if (data.costAmount === 0) { | |
console.log('Skipped the process because the cost amount is zero. Budget name: ' + data.budgetDisplayName); |