Skip to content

Instantly share code, notes, and snippets.

View kentokento's full-sized avatar
🐲

Kento Yamashita kentokento

🐲
  • eureka, Inc.
  • Japan
View GitHub Profile
func create(msg string) *appError {
var e appError
e.message = msg
e.frame = xerrors.Caller(2)
return &e
}
func New(msg string) AppError {
return create(msg)
}
package errors
import (
"fmt"
"golang.org/x/xerrors"
)
// エラー構造体
type appError struct {
@kentokento
kentokento / sendToSlack.js
Created February 12, 2016 03:15
lambda send to slack
console.log('Loading function');
const https = require('https');
const url = require('url');
const slack_url = 'https://hooks.slack.com/services/${ここにtoken}';
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {'Content-Type': 'application/json'};
exports.handler = function(event, context) {
@kentokento
kentokento / aws-cli-s3-permission
Created June 9, 2015 04:19
aws-cliでs3の画像のパーミッションを一括変更
aws s3 ls --recursive s3://{{ bucketName }}/ | awk '{print $4}' | xargs -P4 -I{} aws s3api put-object-acl --acl public-read --bucket {{ bucketName }} --key "{}"
@kentokento
kentokento / show_jira_commit_view.sh
Last active August 29, 2015 14:16
前回リリースからの差分コミットをJQLの形式で表示する
cd pairs.lv;git fetch > /dev/null;echo -n "https://eureka.atlassian.net/issues/?jql=project = PAIRS AND key in (";git log --oneline origin/${1}..origin/${2} | egrep -v "Merge pull request|Merge branch" | sed -e "s@^.\{8\}@@g" | egrep "^PAIRS" | sed "s/\(PAIRS-[0-9]*\).*/\1/g" | tr '\n' ',' | sed "s/,$//g";echo ") ORDER BY key ASC"
@kentokento
kentokento / prepare-commit-msg
Created October 28, 2014 17:28
prepare-commit-msg
#!/bin/sh
if [ "$2" = "message" -o "$2" = "" ] ; then
msg="`cat .git/COMMIT_EDITMSG`"
branch=`git symbolic-ref HEAD 2>/dev/null`
if [ ! -n "`echo "$branch" | sed -e "s/.*\///g" | sed -e "s/[0-9]//g"`" ] ; then
header="`echo $branch | sed -e "s/.*\/\([0-9]\+\)$/PAIRS-\1/g"` "
if [ "$header" = " " ] ; then
echo "$msg" > $1
else
@kentokento
kentokento / git_blame.vim
Created October 8, 2014 13:30
vimrc - vim起動中に選択した部分のみのgit blameを表示する
" 選択した範囲のgit blameを表示
" 選択した状態で :S (押しやすいから)
function! GitBlameOnLineAndFile() range
:execute printf(':!git blame -L %d,%d %s | cat', a:firstline, a:lastline, expand("%:p"))
endfunction
command! -range S :<line1>,<line2>call GitBlameOnLineAndFile()
#!/bin/bash
# show branches list & theses newest log -1
branch=""
branches=`git branch --list`
while read -r branch; do
branch_name=${branch//\*\ /}
label=`git log -1 --pretty=format:'%s' $branch_name`
if expr "$branch" : "^[^\*].*" >/dev/null; then
echo -n " "