Skip to content

Instantly share code, notes, and snippets.

@ijin
ijin / eb_deploy_and_notify.sh
Last active September 29, 2023 16:41
Deploy to Elastic Beanstalk and notify via Slack
#!/bin/bash
set -x
export SHA1=`echo ${CIRCLE_SHA1} | cut -c1-7`
export ENV=`echo $1 | rev | cut -d \- -f1 | rev`
function dd_mute() {
if [[ ${DD_MUTE_ID+x} ]]; then
echo "muting DD monitor id: ${DD_MUTE_ID}"
curl -X POST "https://app.datadoghq.com/api/v1/monitor/${DD_MUTE_ID}/mute?api_key=${DD_API_KEY}&application_key=${DD_APP_KEY}"
@ijin
ijin / eb-api-gw.tf
Last active August 16, 2023 07:54
[Terraform] API Gateway to get Elastic Beanstalk IP(s)
provider "aws" {
region = "ap-northeast-1"
allowed_account_ids = ["${var.names.account_id}"]
}
variable "names" {
default = {
account_id = "$ACCOUNT_ID"
}
}
@ijin
ijin / mqtt.js
Last active October 6, 2021 00:38
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Refresh Sample</title>
<script src="aws-iot-sdk-browser-bundle.js"></script>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.283.1.min.js"></script>
</head>
<body>
@ijin
ijin / gas_google_forms_slack.js
Created August 6, 2019 09:11
Google Apps Script for Google Forms -> Slack
// This Google Sheets script will post to a slack channel when a user submits data to a Google Forms Spreadsheet
// View the README for installation instructions. Don't forget to add the required slack information below.
// Source: https://github.com/markfguerra/google-forms-to-slack
/////////////////////////
// Begin customization //
/////////////////////////
// Alter this to match the incoming webhook url provided by Slack
@ijin
ijin / gas_papercall_slack.js
Last active August 6, 2019 09:09
Google Apps Script for PaperCall -> Slack
var slackIncomingWebhookUrl = 'https://xxxxxxxxxxxx';
var postChannel = "#serverlessdays2019";
var postIcon = ":papercall:";
var postUser = "PaperCall";
var postColor = "#FF7F50";
var messageFallback = "The attachment must be viewed as plain text.";
var messagePretext = "CFPの応募があったよ!\nhttps://www.papercall.io/slsdaystokyo2019";
var title = "Serverless Days Tokyo CFP";
var searchString = "New Submission For ServerlessDays Tokyo 2019";
@ijin
ijin / ecspresso_deploy_and_notify.sh
Last active December 7, 2018 08:57
Deploy to ECR with ecspresso and notify via slack
#!/bin/bash
set -x
export SHA1=`echo ${CIRCLE_SHA1} | cut -c1-7`
export CONFIG_YML=$1
shift
export SERVICE=`./ecspresso deploy --config=$CONFIG_YML --dry-run | grep Service | awk '{print $2}'`
echo "deploying"
time ./ecspresso deploy --config=$CONFIG_YML $@
@ijin
ijin / ecspresso_run_and_notify.sh
Last active October 24, 2018 04:18
Run task on ECR with ecspresso and notify via slack
#!/bin/bash
set -x
export SHA1=`echo ${CIRCLE_SHA1} | cut -c1-7`
export CONFIG_YML=$1
shift
echo "running task"
time ./ecspresso run --config=$CONFIG_YML $@
@ijin
ijin / keybase.md
Created August 5, 2018 20:23
keybase proof

Keybase proof

I hereby claim:

  • I am ijin on github.
  • I am ijin (https://keybase.io/ijin) on keybase.
  • I have a public key ASC0K2jw7KG85ZUgkGzUlvumbqPjziWb8_xoVmxYsbsFsgo

To claim this, I am signing this object:

@ijin
ijin / percona_raid_ec2.sh
Created July 28, 2011 15:55
percona server & raid setup on ec2
# install percona server
wget http://www.percona.com/downloads/RPM-GPG-KEY-percona
sudo apt-key add RPM-GPG-KEY-percona
echo "deb http://repo.percona.com/apt `lsb_release -cs` main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://repo.percona.com/apt `lsb_release -cs` main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install percona-server-server-5.1 percona-server-client-5.1 percona-server-common libmysqlclient-dev
@ijin
ijin / cloudwatch_logs.py
Created December 9, 2015 16:40
AWS Lambda function that processes cloudwatch logs and invokes a slack function
import boto3
import datetime
import json
import urllib2
import base64
import gzip
from StringIO import StringIO
print('Loading function')