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
# coding: utf-8 | |
require 'rest-client' | |
require 'json' | |
require 'date' | |
require 'gmail' | |
require 'yaml' | |
#google-api-clientはv0.6.4が必要です | |
require "google/api_client" |
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
# coding: utf-8 | |
require 'rest-client' | |
require 'json' | |
require 'date' | |
require 'holiday_jp' | |
require 'gmail' | |
class MyMail | |
ID = "GMail address" |
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
# coding: utf-8 | |
require 'rest-client' | |
require 'json' | |
class LineBot | |
ID = "Channel ID" | |
SECRET = "Channel Secret" | |
MID = "MID" | |
TO = "送信先のID" |
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
# coding: utf-8 | |
require 'rest-client' | |
require 'json' | |
ID = "Channel ID" | |
SECRET = "Channel Secret" | |
MID = "MID" | |
TO = "送信先のID" |
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 https = require('https'); | |
exports.handler = function(event, context) { | |
console.log('Received event:', JSON.stringify(event, null, 2)); | |
var msg = event.result[0]; | |
console.log('Message To', msg.content.from.toString()); | |
var data = JSON.stringify({ | |
to: [msg.content.from.toString()], | |
toChannel: 1383378250, | |
eventType: "138311608800106203", |
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
# coding: utf-8 | |
require 'rest-client' | |
require 'json' | |
ID = "Channel ID" | |
SECRET = "Channel Secret" | |
MID = "MID" | |
response = RestClient::Request.execute( |
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
#システム全体で利用できるようにrbenvをインストールするメモ | |
#CentOSにインストールすることを前提にしている | |
su - | |
#インストールに必要なものをインストール | |
yum install -y git gcc gcc-c++ openssl-devel readline-devel | |
#rbenvのインストール | |
cd /usr/local |
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
def calc_modulus10(v) | |
val = v.reverse | |
pos = total_even = total_odd = 0 | |
val.split(//).each do |d| | |
pos = pos + 1 | |
(pos % 2) == 0 ? total_even += d.to_i : total_odd += d.to_i | |
end | |
digit = 10 - (total_even + total_odd * 3).to_s[-1,1].to_i | |
digit = 0 if digit == 10 | |
return digit.to_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
FROM centos:latest | |
MAINTAINER vivahiraj | |
RUN yum -y install vi | |
RUN echo 'ZONE="Asia/Tokyo"' > /etc/sysconfig/clock | |
RUN cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime | |
RUN yum groupinstall -y japanese-support | |
RUN echo 'LANG="ja_JP.UTF-8"' > /etc/sysconfig/i18n |
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
FROM centos:latest | |
MAINTAINER vivahiraj | |
ENV ADD_USER tomato | |
ENV USER_PWD tomato | |
RUN yum update -y | |
RUN yum -y install openssh-server | |
RUN sed -ri 's/required pam_loginuid.so/optional pam_loginuid.so/g' /etc/pam.d/sshd |