Skip to content

Instantly share code, notes, and snippets.

--- ../html.bak/index.html 2019-07-04 03:46:11.000000000 +0900
+++ index.html 2019-07-04 11:45:24.008447808 +0900
@@ -75,9 +75,22 @@
<!-- 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 -->
-<script src="/__/firebase/6.2.4/firebase-app.js"></script>
-<script src="/__/firebase/6.2.4/firebase-messaging.js"></script>
-<script src="/__/firebase/init.js"></script>
+<script src="https://www.gstatic.com/firebasejs/6.2.4/firebase-app.js"></script>
@smd877
smd877 / pushFcm.py
Last active July 2, 2019 06:34
FCM使ってWebPushするPythonこーど
#coding: UTF-8
import os
import json
import urllib.request, urllib.parse
SEND_URL = 'https://fcm.googleapis.com/fcm/send'
def lambda_handler(event, context):
headers = {
'Content-Type': 'application/json',
@smd877
smd877 / sendmail.py
Created November 7, 2018 13:36
AWS LambdaでGmailの送信
#coding: UTF-8
import os
import smtplib
from email.mime.text import MIMEText
# Gmailアカウント
FROM_ADDR = os.environ['mail_from_addr']
# アプリパスワード
PASSWD = os.environ['mail_passwd']
# 送信先メールアドレス
@smd877
smd877 / controlec2.py
Created October 1, 2018 05:07
AWS Lambda ControlEC2 Code
import boto3
def lambda_handler(event, context):
command = event.get('command')
if command in ['start', 'stop', 'status']:
try:
instance = boto3.resource('ec2').Instance(event.get('target'))
state = instance.state['Name']
if command == 'start' and state == 'stopped':
instance.start()

Title

Hi, my name is smd877.


Lists

  • List1
  • List2
@smd877
smd877 / SimpleSample 01 SimpleSampleActivity.java
Last active December 12, 2015 04:39
Androidで利用できるxmlパーサー「simple」のサンプル
package jp.gr.java_conf.smd877.simplesample;
import android.os.Bundle;
import android.view.View;
import android.app.Activity;
/**
* xmlパーサーSimpleを試すためのActivity
*/
public class SimpleSampleActivity extends Activity {
@smd877
smd877 / getRecordList.sql
Created October 12, 2012 07:57
PostgreSQLでDBの各テーブルのレコード数を確認したいとき
SELECT T2.relname
, T2.reltuples
FROM pg_stat_user_tables AS T1
INNER JOIN pg_class AS T2
ON T1.relname = T2.relname
ORDER BY T2.relname;
@smd877
smd877 / GCMSendSample.java
Created September 27, 2012 10:17
ローカル起動でGCMのメッセージをpush要求する
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
@smd877
smd877 / do.jsp
Created September 27, 2012 10:13
registration_idを取得する用のjsp
<%@ page import="java.util.Enumeration" %>
<%
Enumeration<String> en = request.getParameterNames();
while (en.hasMoreElements()) {
String name = en.nextElement();
System.out.print(name + " = ");
System.out.println("" + request.getParameter(name));
}
out.println("fin.");
%>
@smd877
smd877 / CommonUtilities.java
Created September 27, 2012 09:47
GCMのClientDemoを簡略化
package com.google.android.gcm.demo.app;
import android.content.Context;
import android.content.Intent;
public final class CommonUtilities {
/** サードパーティのID登録/解除用URL */
static final String SERVER_URL = "http://localhost:8080/jsp";