Skip to content

Instantly share code, notes, and snippets.

View 1syo's full-sized avatar

Kazunari Takahashi 1syo

View GitHub Profile
provider "aws" {}
#
# VPC
#
resource "aws_vpc" "vpc" {
cidr_block = "10.10.0.0/16"
instance_tenancy = "default"
enable_dns_hostnames = true
class Token
include ActiveModel::Model
attr_accessor :email
validate :ensure_effective_token
def initialize(token, email, expire_at)
@token, @email, @expire_at = token, email, expire_at
end
name="1syo"
data_url="$(curl http://lgtm.in/g/$name --write-out "%{redirect_url}" --silent)"
image_url="$(echo $data_url | sed -e 's/http:\/\/lgtm.in\/i/http:\/\/lgtm.in\/p/g')"
cat <<-__TEXT__
LGTM :+1:
[![LGTM]($image_url)]($data_url)
__TEXT__
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/cache/jenkins/war;
index index.html;
server_name _;
server_tokens off;
location / {
auth_basic "Restricted";
@1syo
1syo / ciho
Last active December 26, 2015 04:44
#!/bin/bash
if [ $# -ne 1 ]; then
echo 'Argumant error.'
exit 1
fi
repo=$1
header="Accept: application/vnd.travis-ci.2+json"
url="https://api.travis-ci.org/repos/${repo}/builds"
class CreateArticles < ActiveRecord::Migration
def change
create_table :articles do |t|
t.string :title, null: false
t.text :content, null: false
t.binary :image
t.timestamps null: false
end
end
end
@1syo
1syo / gmail.coffee
Last active November 9, 2015 08:53
# Description:
# Gmail messege.
#
google = require('googleapis')
googleAuth = require('google-auth-library')
CronJob = require('cron').CronJob
_ = require('underscore')
SLACK_USER_NAME = process.env.SLACK_USER_NAME || ''
CLIENT_SECRET = process.env.CLIENT_SECRET || ''
CLIENT_ID = process.env.CLIENT_ID || ''
@1syo
1syo / Main.js
Last active November 7, 2015 04:16
tower-of-babel
var arg1 = process.argv[2];
var arg2 = process.argv[3];
import {PI, sqrt, square} from './Math';
console.log(PI);
console.log(sqrt(+arg1));
console.log(square(+arg2));
# Description:
# Yammer messege.
#
YAMMER_USER_ID = process.env.YAMMER_USER_ID || 0
YAMMER_API_TOKEN = process.env.YAMMER_API_TOKEN || ""
ROOM_NAME = process.env.ROOM_NAME || "general"
KEY = 'yammer-latest-message-id'
Yammer = new require('yammer').Yammer
CronJob = require('cron').CronJob
# Description:
# Example scripts for you to examine and try out.
#
util = require('util')
module.exports = (robot) ->
robot.respond /node\sversion/i, (msg) ->
msg.send "My node version is: #{process.version}"
robot.respond /env/i, (msg) ->
msg.send "My environment is: #{util.inspect(process.env,false,null)}"