Skip to content

Instantly share code, notes, and snippets.

@yoshimov
yoshimov / hive.cmd
Created January 8, 2014 10:15
hive.cmd for hive 0.12.0 on windows.
@echo off
set HIVE_BIN_PATH=%~dp0
if "%HIVE_BIN_PATH:~-1%" == "\" (
set HIVE_BIN_PATH=%HIVE_BIN_PATH:~0,-1%
)
set HIVE_HOME=%HIVE_BIN_PATH%\..
set HIVE_LIB=%HIVE_HOME%\lib
set HADOOP_HOME=%HIVE_HOME%\..
set HADOOP=%HADOOP_HOME%\bin\hadoop.cmd
@yoshimov
yoshimov / esp8266-espruino-light-sensor.js
Created September 8, 2016 00:48
Light sensor script for Espruino on ESP8266
var http = require("http");
var pre = 0;
var count = 0;
var MAX = 50;
var TIMEOUT = 100;
var POSTURL="http://dweet.io/dweet/for/xxx";
var NOTIFYURL="http://auto-remote-url";
function loop() {
// 0 < val < 1

Mastodon on ECSの構成

これだけ使ってみました。

  • Amazon ELB x2
    • Webサイト用とStreaming用に2つ用意
  • Amazon ElastiCache x1
    • Redisのt2.micro
  • Amazon RDS x1
  • PostgreSQLのt2.micro
@yoshimov
yoshimov / mastodon-http.diff
Last active May 19, 2017 01:51
mastodon v1.3.3 patch for http server
--- /mastodon/app/lib/tag_manager.rb.org
+++ /mastodon/app/lib/tag_manager.rb
@@ -69,7 +69,7 @@
uri = Addressable::URI.new
uri.host = domain.gsub(/[\/]/, '')
- uri.normalize.host
+ uri.normalize.authority
end
@yoshimov
yoshimov / slack-train-notify.gs
Last active September 13, 2016 09:02
Notify train accident to Slack using Google Apps Script
// GAS Script for train daemon on Slack
// ScriptProperties:
// - trainUrl: JR line information web page URL
// - trainName: Name of JR line
// - slackHookUrl: Slack web hook URL
// - slackChannel: Channel name of Slack
function trainRetrieve() {
var url = PropertiesService.getScriptProperties().getProperty("trainUrl");
@yoshimov
yoshimov / slack-rain-notify.gs
Last active September 13, 2016 08:43
Notify tenki.jp weather to Slack using Google Apps Script
// GAS Script for weather daemon on Slack
// ScriptProperties:
// - weatherUrl: Local weather web page URL on tenki.jp
// - slackHookUrl: Slack web hook URL
// - slackChannel: Channel name of Slack
function rainRetrieve() {
var url = PropertiesService.getScriptProperties().getProperty("weatherUrl");
var res = UrlFetchApp.fetch(url);
@yoshimov
yoshimov / fetch-latest-dweet.gs
Created September 1, 2016 02:42
Fetch latest dweet data and append to spreadsheet
function addData(time, val) {
var sheet = SpreadsheetApp.getActiveSheet();
var last = sheet.getLastRow();
var cell = sheet.getRange(last, 1);
var pretime = cell.getValue();
if (pretime != time) {
cell.offset(1, 0).setValue(time);
cell.offset(1, 1).setValue(val);
}
}
@yoshimov
yoshimov / Powershell-batch.bat
Created February 15, 2016 08:11
Powershell batch
@powershell -NoProfile -ExecutionPolicy Unrestricted "$s=[scriptblock]::create((gc \"%~f0\"|?{$_.readcount -gt 1})-join\"`n\");&$s" %*&goto:eof
# some powershell script
*** Get-WebFile.ps1.org 2013-12-11 13:59:13.174257200 +0900
--- Get-WebFile.ps1 2013-12-13 13:54:21.563447100 +0900
***************
*** 48,54 ****
Write-Debug "Setting the UserAgent to `'$userAgent`'"
$req.UserAgent = $userAgent
}
! $res = $req.GetResponse();
if($fileName -and !(Split-Path $fileName)) {
@yoshimov
yoshimov / checkNotify.js
Created January 7, 2014 11:24
GASで問い合わせ対応状況を1日に1回通知するスクリプト。
function checkNotification() {
var sheet = SpreadsheetApp.getActiveSheet();
var cell = sheet.getRange("G2");
var notify = false;
var str = "";
while (!cell.isBlank()) {
if (cell.getValue().toString() == "未") {
notify = true;
str += cell.offset(0, -6).getValue() + "番の問い合わせに未回答です。\n";
str += "担当は" + cell.offset(0, -1).getValue() + "さんです。\n";