This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deleteOldMail() { | |
var sheet = SpreadsheetApp.getActive().getSheetByName('label'); | |
for(var row=2; row<=sheet.getLastRow(); row++){ | |
var labelName = sheet.getRange(row, 1).getValue(); | |
var days = sheet.getRange(row, 2).getValue(); | |
var deleteThreads = GmailApp.search('older_than:'+days+'d -is:starred label:'+ labelName); | |
for (var i = 0; i < deleteThreads.length; i++) { | |
deleteThreads[i].moveToTrash(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
import urllib | |
import sys | |
from xml.etree import ElementTree | |
doItAgain = "yes" #Control While loop | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
n = 100 | |
digits = int(math.log10(n) + 1) # 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var fs = require('fs'); | |
const SLACK_BOT_TOKEN = 'hogehoge'; | |
const api_url = 'https://slack.com/api/'; | |
var fileName = 'hogefuga.png'; | |
var channel = 'general'; | |
options = { | |
token: SLACK_BOT_TOKEN, | |
filename: fileName, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
protoPayload.authenticationInfo.principalEmail AS email, | |
ROUND(SUM(protoPayload.serviceData.jobCompletedEvent.job.jobStatistics.totalBilledBytes) /1000000000, 3) AS total_GBytes, | |
protoPayload.serviceData.jobCompletedEvent.job.jobStatistics.billingTier AS billing_tier, | |
COUNT(protoPayload.serviceData.jobCompletedEvent.job.jobConfiguration.query.query) AS query_count, | |
protoPayload.serviceData.jobCompletedEvent.job.jobConfiguration.query.query AS query_string, | |
FROM | |
TABLE_DATE_RANGE(AuditLogs.cloudaudit_googleapis_com_data_access_, DATE_ADD(CURRENT_TIMESTAMP(), -7, 'DAY'), CURRENT_TIMESTAMP()) | |
WHERE | |
protoPayload.serviceData.jobCompletedEvent.eventName = 'query_job_completed' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* スプレッドシートに記載したURLの外形監視を実行する。 | |
* 指定されたURLに接続してステータスコードが200以外の場合メールで通知する。 | |
* また、前回の実行時に200以外のステータスコードだった場合で、 | |
* ステータスが200になった場合は復旧メールを送信する。 | |
* スプレッドシートの項目は、サービス名, 監視対象URL, ステータス, emails(10個まで) とする。 | |
*/ | |
function monitoring() { | |
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf_8 -*- | |
import json | |
import sys, os, datetime | |
import pymongo | |
# sysモジュールをリロードする | |
reload(sys) | |
# デフォルトの文字コードを変更する. | |
sys.setdefaultencoding('utf_8') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
id, | |
case | |
when ((dt_bit & 31) = 31) then 5 | |
when ((dt_bit & 15) = 15) then 4 | |
when ((dt_bit & 7) = 7) then 3 | |
when ((dt_bit & 3) = 3) then 2 | |
when ((dt_bit & 1) = 1) then 1 | |
else 0 | |
end as fq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Mail = Application("Mail"); | |
Mail.includeStandardAdditions = true; | |
// 選択したメッセージを取得 | |
var messages = Mail.selection(); | |
for (i = 0; i < messages.length; i++) { | |
var thisMessage = messages[i]; | |
// メッセージに添付されたファイルを取得しhogehogeユーザホームに保存する | |
var atFiles = thisMessage.mailAttachments(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var projectId = process.env.GCLOUD_PROJECT_ID | |
var gcloud = require('gcloud')({ | |
projectId: projectId, | |
keyFilename: '/local/path/to/keyfile' | |
}); | |
var storage = gcloud.storage(); | |
var bucket = storage.bucket('storageName'); | |
var options = { | |
destination: '2015/05/file', |