Skip to content

Instantly share code, notes, and snippets.

@smd877
smd877 / setup_eccube_command
Created August 24, 2020 02:49
AWSのEC2にEC-CUBEをインストールする
yum update -y
amazon-linux-extras install -y lamp-mariadb10.2-php7.2
yum install -y mariadb-server
yum install -y httpd php php-xml php-mbstring php-zip php-intl
cd /usr/local/src/
wget http://downloads.ec-cube.net/src/eccube-4.0.4.zip
unzip eccube-4.0.4.zip
mv eccube-4.0.4 /var/www/html/ec
chown -R apache:apache /var/www/html/
echo -e '<Directory "/var/www/html/ec">\n AllowOverride All\n</Directory>' > /etc/httpd/conf.d/ec.conf
@smd877
smd877 / prepare_python_for_alexa.sh
Created April 27, 2020 09:58
Alexaスキル用のPython環境用意するためのスクリプト
#!/bin/sh
yum update -y
yum -y groupinstall "Development Tools"
yum -y install openssl-devel bzip2-devel readline-devel sqlite-devel libffi-devel
git clone https://github.com/yyuu/pyenv.git /opt/pyenv
echo 'export PYENV_ROOT="/opt/pyenv"' >> /root/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> /root/.bash_profile
echo 'eval "$(pyenv init -)"' >> /root/.bash_profile
source /root/.bash_profile
pyenv install 3.8.2
@smd877
smd877 / CkeckBacklog.py
Created April 13, 2020 07:10
Backlogのチケット更新状況から、前日以降更新されて自社メンバーが担当になっているものをメールで通知する。
#coding: UTF-8
import os
import json
import boto3
import urllib.request, urllib.parse
from datetime import date, timedelta
SPACE_URL = os.environ['SPACE_URL']
API_URL = SPACE_URL + '/api/v2/issues?apiKey=' + os.environ['API_KEY']
@smd877
smd877 / sendMailSes.py
Created March 27, 2020 14:47
AWS LambdaでSESを使ってメールを送信
import os
import smtplib
from email.mime.text import MIMEText
def lambda_handler(event, context):
to_addr = event.get('to_addr')
subject = event.get('subject')
body = event.get('body')
msg = MIMEText(body)
msg['Subject'] = subject
@smd877
smd877 / postStatus.py
Created February 1, 2020 14:20
AWSのコストとEC2の状況をLINEで報告するLambda
#coding: UTF-8
import os
import boto3
import json
import copy
import urllib.request, urllib.parse
from datetime import datetime, timedelta
URL = 'https://api.line.me/v2/bot/message/push'
import os
import json
import urllib.request, urllib.parse
URL = 'https://api.line.me/v2/bot/message/push'
def lambda_handler(event, context):
to = event['to'] if 'to' in event.keys() else os.environ['SEND_TO']
token = event['token'] if 'token' in event.keys() else os.environ['CHANNEL_TOKEN']
headers = {
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
</head>
<body>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
export AUTH_KEY=ここにクラウドメッセージングタブのサーバーキーを入力
export SEND_TO=ここにブラウザで取得したInstance ID Tokenを入力
curl -X POST -H "Authorization: key=$AUTH_KEY" -H "Content-Type: application/json" -d '{ "notification": { "title": "This is Title!!!", "body": "Body Body Body.", "icon": "firebase-logo.png" }, "to": "'$SEND_TO'" }' "https://fcm.googleapis.com/fcm/send"
cd /usr/share/nginx/html/
svn export --force https://github.com/firebase/quickstart-js/trunk/messaging .
cp -pr . ../html.bak
vi firebase-messaging-sw.js
diff -u ../html.bak/firebase-messaging-sw.js firebase-messaging-sw.js > ../firebase-messaging-sw.js.patch
vi index.html
diff -u ../html.bak/index.html index.html > ../index.html.patch
--- ../html.bak/firebase-messaging-sw.js 2019-07-04 03:46:11.000000000 +0900
+++ firebase-messaging-sw.js 2019-07-04 11:41:01.940048485 +0900
@@ -1,9 +1,19 @@
// Import and configure the Firebase SDK
// These scripts are made available when the app is served or deployed on Firebase Hosting
// If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup
-importScripts('/__/firebase/5.5.6/firebase-app.js');
-importScripts('/__/firebase/5.5.6/firebase-messaging.js');
-importScripts('/__/firebase/init.js');
+importScripts('https://www.gstatic.com/firebasejs/6.2.4/firebase-app.js');