This file contains 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 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 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 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 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', |
This file contains 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
/* | |
* 使いにくい部分があったのでいろいろ直していますが | |
* 基本は以下のライブラリのソースを使っています。 | |
* | |
* Sitemap Parser | |
* Copyright (c) 2014 Sean Thomas Burke | |
* Licensed under the MIT license. | |
* https://github.com/hawaiianchimp/sitemap-parser.git | |
*/ |
This file contains 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 | |
import os | |
import commands | |
# logging config | |
from logging import getLogger,StreamHandler,Formatter,DEBUG | |
logger = getLogger(__name__) | |
handler = StreamHandler() | |
handler.setLevel(DEBUG) | |
handler.setFormatter(Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')) |
This file contains 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
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { | |
println("AccountsViewController#tableView cellForRowAtIndexPath called.") | |
let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell") | |
// ユーザIDを表示する | |
cell.textLabel?.text = accounts[indexPath.row].username | |
// プロフィール画像を取得して非同期で表示させる | |
var q_global: dispatch_queue_t = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); | |
var q_main: dispatch_queue_t = dispatch_get_main_queue(); | |
cell.imageView?.image = nil; | |
dispatch_async(q_global, { |
This file contains 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 today = new Date(); | |
new Date(today.getFullYear(), today.getMonth() + 1, 0); | |
// error | |
dt.setFullYear(today.getFullYear()); | |
dt.setMonth(today.getMonth()+1); | |
dt.setDate(0); | |
dt.getDate(); |
This file contains 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
// for GitHub webhook | |
router.all('/webhook', function(req, res) { | |
var cmd = exec("git pull", { | |
cwd: conf.deploy.dir | |
}, function(error, stdout, stderr) { | |
if (error) { | |
debug("> ERROR (error): " + error); | |
} | |
if (stderr && error) { | |
debug("> ERROR (error): " + error); |