Skip to content

Instantly share code, notes, and snippets.

Avatar

Kazuma Watanabe wata727

View GitHub Profile
View steep-lsp.el
(require 'lsp-mode)
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("bundle" "exec" "steep" "langserver"))
:major-modes '(ruby-mode enh-ruby-mode)
:priority -2
:server-id 'steep-ls))
(add-hook 'ruby-mode-hook #'lsp)
View pickaxe.rb
equire "rugged"
def diff_between_parent(commit)
return if commit.parents.empty?
parent = commit.parents.inject do |ret, item|
commit.diff(ret).size < commit.diff(item).size ? ret : item
end
commit.diff(parent).each_patch do |patch|
patch.each_hunk do |hunk|
@wata727
wata727 / main.go
Created Oct 8, 2018
go/types: type check is failed with custom importer (golang.org/x/tools/go/packages)
View main.go
package main
import (
"go/ast"
"go/parser"
"go/token"
"go/types"
"io/ioutil"
"golang.org/x/tools/go/packages"
@wata727
wata727 / user.php
Last active Nov 29, 2015
FuelPHPでdbunitを使ってテストするサンプル
View user.php
<?php
/**
* 使用バージョン
* FuelPHP 1.7.0
* PHPUnit 4.8.18
* DBUnit 2.0.2
*
* /user/createはGETメソッドで単純に決められたデータを登録するだけのイメージ
*
@wata727
wata727 / add_menulist.pl
Last active Sep 20, 2015
kobayasitabelにTwitterからメニューを登録するスクリプト
View add_menulist.pl
#!/usr/bin/perl
use strict;
use warnings;
use Encode;
use Net::Twitter;
use Text::MeCab;
use LWP::UserAgent;
use HTTP::Request::Common;
@wata727
wata727 / control-sg-myip.sh
Created Feb 22, 2015
自分のIPをSecurityGroupに登録する。22,80,8080,8090番を許可、無効化する
View control-sg-myip.sh
#!/bin/bash
# example : sh control-sg-myip.sh [action]
# action -> [auth,revoke]
if [ $# -ne 1 ]; then
echo "Error: Invalid argument count." 1>&2
exit 1
fi
sgid='sg-XXXXXXXX'
myip=`curl -s ifconfig.me`
@wata727
wata727 / instance-controller.sh
Created Feb 15, 2015
EC2のNameタグ名でインスタンスの起動、停止を行う。aws-cliとjqを使用。
View instance-controller.sh
#!/bin/bash
# example: sh instance-controler.sh [action] [name]
# action -> [start,stop]
# name -> ec2 tag name
if [ $# -ne 2 ]; then
echo "Error: Invalid argument count." 1>&2
exit 1
fi
action=$1
name=$2
You can’t perform that action at this time.