Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'uri'
if ARGV.size != 1
warn "Invalid argument"
exit
end
methods = []
@simeji
simeji / file0.txt
Last active December 31, 2015 12:21
Vimがちょっと便利になる5つ起動オプション(おまけあり) ref: http://qiita.com/simeji/items/41f4c1bd4e9a2b3c1526
vim +45 test.rb
@simeji
simeji / vim-practice-1.txt
Created June 16, 2014 08:34
Vim practice text
Amazon Web Services (abbreviated AWS) is a collection of remote computing services (also called web services) that together make up a cloud computing platform, offered over the Internet by Amazon.com.
The most central and well-known of these services are Amazon EC2 and Amazon S3.
The service is advertised as providing a large computing capacity (potentially many servers) much faster and cheaper than building a physical server farm.
@simeji
simeji / vim-practice-2.txt
Created June 16, 2014 08:40
Vim practice
The MIT License (MIT)
Copyright (c) 2014 simeji
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@simeji
simeji / vim-practice-3
Last active August 29, 2015 14:02
vim-practice-3
hoge
moge
fuga
bar
test
this is a pen
hoge = [Hoge]
moge = [Moge]
" insert map
imap <C-t> Helloworld!!<CR>
" normal map
nmap <C-f> :echo expand('%:p')<CR>
" visual map
vmap <C-e> :s/xxxx/homes/g<CR>
" commandline map
cmap <C-a> <Home>
cmap <C-e> <End>
cmap <C-f> <Right>
@simeji
simeji / function.vim
Created September 29, 2014 09:46
vim-sample
" function sample
function TestFunction(a,b,c)
echo a:a
echo a:b
echo a:c
endfunction
" 引数の設定
com -nargs=+ TestFunc call TestFunction(<f-args>)
@simeji
simeji / file0.txt
Created February 27, 2015 02:20
特定のタグのついたセキュリティグループ内容を編集だけできるIAMポリシー ref: http://qiita.com/simeji/items/dc32b2dec0362376258f
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:AuthorizeSecurityGroupEgress",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:RevokeSecurityGroupEgress",
"ec2:RevokeSecurityGroupIngress"
@simeji
simeji / descrive_ec2_instances.go
Last active May 29, 2023 20:09
Get EC2 instance list filtered by NameTag
package main
import (
"fmt"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/aws/credentials"
"github.com/awslabs/aws-sdk-go/service/ec2"
)
func main() {
@simeji
simeji / file0.txt
Last active September 16, 2015 17:50
AWS CLI で現在停止中で30日以上前に起動されたインスタンスを取得するワンライナー ref: http://qiita.com/simeji/items/3d680c3a59897700f43c
$ ago=30;date -v-${ago}d > /dev/null 2>&1 && DATE=`date -v-${ago}d +%Y-%m-%d` || DATE=`date --date="-${ago} days" +%Y-%m-%d`; aws ec2 describe-instances --filter Name=instance-state-name,Values=stopped --query "Reservations[].Instances[?LaunchTime<='$DATE'][].{InstanceId: InstanceId,PrivateIpAddress: PrivateIpAddress,LaunchTime: LaunchTime}"