Skip to content

Instantly share code, notes, and snippets.

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(
require 'digest'
# ビット配列を簡単に扱う為のクラス
class BitArray
def initialize m
@size = (m - 1) / 32 + 1
@array = [0] * @size
end
# 指定されたビット目を立てる
#!/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.
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) {
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
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
}
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: [{
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: [{
#!/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.
puts gets.split('').select.with_index {|c, i| i.even?}.join ''