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
struct Group: Decodable { | |
let name: String | |
let floor: Int | |
let locationName: String | |
let optional: [String]? | |
// MARK: Decodable | |
static func decode(e: Extractor) throws -> Group { | |
return try Group( |
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
require 'digest' | |
# ビット配列を簡単に扱う為のクラス | |
class BitArray | |
def initialize m | |
@size = (m - 1) / 32 + 1 | |
@array = [0] * @size | |
end | |
# 指定されたビット目を立てる |
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
#!/bin/sh | |
cat << 'EOF' > /etc/init.d/ec2-elb-re-register | |
#!/bin/bash | |
# re-register EC2 to ELB | |
# | |
# chkconfig: 2345 99 10 | |
# description: Remove EC2 from ELB, and add EC2 with ELB | |
# Source function libarary. |
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 AWS = require('aws-sdk'); | |
var ec2 = new AWS.EC2({apiVersion: '2015-10-26'}); | |
exports.handler = function(event, context) { | |
ec2.describeInstances({}, function(err, data) { | |
if (err) { | |
console.log(err, err.stack); | |
context.done('error', err.stack); | |
return; | |
} | |
var is_target = function(tags) { |
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
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv | |
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile | |
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile | |
source ~/.bash_profile | |
rbenv install 2.2.3 | |
rbenv global 2.2.3 |
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
s() { | |
line=`aws ec2 describe-instances | jq -r '.Reservations[] | .Instances[] | select(.State.Name != "terminated") | select(has("PrivateIpAddress")) | [.PrivateIpAddress,.State.Name,(.Tags[] | select(.Key == "Name") | .Value // "")] | join("\t")' | peco | tr '\n' ' '` | |
if [ "$line" != "" ]; then | |
echo $line | |
ip=`echo $line | awk '{print $1}'` | |
ssh -i ~/.ssh/id_rsa -l ec2-user $ip | |
fi | |
} |
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 AWS = require('aws-sdk'); | |
var ec2 = new AWS.EC2({ | |
apiVersion: '2015-10-10', | |
accessKeyId: '', | |
secretAccessKey: '', | |
region: 'ap-northeast-1' | |
}); | |
exports.handler = function(event, context) { | |
ec2.describeInstances({ | |
Filters: [{ |
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 AWS = require('aws-sdk'); | |
var ec2 = new AWS.EC2({ | |
apiVersion: '2015-10-10', | |
accessKeyId: '', | |
secretAccessKey: '', | |
region: 'ap-northeast-1' | |
}); | |
exports.handler = function(event, context) { | |
ec2.describeInstances({ | |
Filters: [{ |
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
#!/bin/sh | |
cat << 'EOF' > /etc/init.d/ec2-elb-re-register | |
#!/bin/bash | |
# re-register EC2 to ELB | |
# | |
# chkconfig: 2345 99 10 | |
# description: Remove EC2 from ELB, and add EC2 with ELB | |
# Source function libarary. |
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
puts gets.split('').select.with_index {|c, i| i.even?}.join '' |
NewerOlder