Skip to content

Instantly share code, notes, and snippets.

@yasuhito
yasuhito / gist:9262976
Last active August 29, 2015 13:56
Trema を使っている人々

ソフトウェア・サービス

Wakame-vdc: Datacenter Hypervisor - Open Source Cloud Computing / IaaS

  • プレスリリース: http://axsh.jp/news/publicity/894
  • ソースコード: https://github.com/axsh/wakame-vdc/
  • 主なユーザ
    • 国立情報学研究所 (プライベートクラウド)
    • 九州電力 (プライベートクラウド)
    • 大手メーカー (顧客向けWebシステムの基盤として)
    • NTTPCコミュニケーションズ WebARENA VPSクラウド (パブリッククラウド)
    • 京セラコミュニケーションシステム GreenOffice Unified Cloud (パブリッククラウド)
@yasuhito
yasuhito / git_issue.zsh
Last active September 4, 2015 10:08
https://gist.github.com/azu/d3fb5f970e4ff945ead4 を percol から peco にしただけのモノです
# peco + git issue
function found_command { which $1 &> /dev/null }
function is_issued() {
ISSUE_TYPE=$(git config issue.type 2>/dev/null)
if [ "$ISSUE_TYPE" != "" ]; then
return 0
else
return 1
fi
}
class RoutingSwitch < Trema::Controller
# ...
def start_topology
TopologyController.new { |topo| topo.add_observer @path_manager }.start
end
end
class PathManager < Trema::Controller
# ...
def delete_link(port_a, port_b, _topology)
# L2 routing path manager
class PathManager < Trema::Controller
def packet_in(_dpid, message)
path = maybe_create_shortest_path(message)
ports = path ? [path.out_port] : @graph.external_ports
ports.each do |each|
send_packet_out(each.dpid,
raw_data: message.raw_data,
actions: SendOutPort.new(each.number))
end
@yasuhito
yasuhito / rest.rb
Last active December 11, 2015 08:28
get 'slices/:slice_id' do
rest_api { Slice.find_by!(name: params[:slice_id]) }
end
class Slice
def self.find_by!(query)
# ...
remote_klass =
Trema.trema_process('RoutingSwitch', socket_dir).controller.slice
remote_klass.find_by!(query)
class RoutingSwitch < Trema::Controller
delegate :switch_ready, to: :@topology
delegate :features_reply, to: :@topology
delegate :switch_disconnected, to: :@topology
delegate :port_modify, to: :@topology
def packet_in(dpid, packet_in)
@topology.packet_in(dpid, packet_in)
@path_manager.packet_in(dpid, packet_in) unless packet_in.lldp?
@yasuhito
yasuhito / -
Created February 29, 2016 05:09
/home/yasuhito/.rvm/rubies/ruby-2.1.8/bin/ruby -I/home/yasuhito/.rvm/gems/ruby-2.1.8/gems/rspec-core-3.2.3/lib:/home/yasuhito/.rvm/gems/ruby-2.1.8/gems/rspec-support-3.2.2/lib /home/yasuhito/.rvm/gems/ruby-2.1.8/gems/rspec-core-3.2.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
You are using HTTP Gem 0.5.1. WebMock supports version >= 0.6.0.
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's default settings.
/home/yasuhito/.rvm/gems/ruby-2.1.8/gems/sinatra-contrib-1.4.4/lib/sinatra/respond_with.rb:4: warning: variable $KCODE is no longer effective; ignored
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
VNetAPIClient
/home/yasuhito/.rvm/rubies/ruby-2.1.8/bin/ruby -I/home/yasuhito/.rvm/gems/ruby-2.1.8/gems/rspec-core-3.4.3/lib:/home/yasuhito/.rvm/gems/ruby-2.1.8/gems/rspec-support-3.4.1/lib /home/yasuhito/.rvm/gems/ruby-2.1.8/gems/rspec-core-3.4.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
You are using HTTP Gem 0.5.1. WebMock supports version >= 0.6.0.
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's default settings.
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
VNetAPIClient
has implemented and tested all routes in the OpenVNet WebAPI
@yasuhito
yasuhito / title_helper.rb
Created March 23, 2019 04:12
タイトルのヘルパ
module TitleHelper
def title(text: nil, size: nil, url: nil, spaced: false, &block)
body = text || capture(&block) || raise('Text is a mandatory.')
klass = CssClassString::Helper.new('title', "is-#{size}" => size, 'is-spaced' => spaced).to_s
if url
link_to body, url, class: klass
else
tag.__send__ "h#{size || 3}", body, class: klass
end
end
<%= link_to 'ライブラリを見る',
library_index_path,
class: 'inline-block border-b-4 active:mt-1 active:border-b-0 bg-green-400 border-green-500 font-bold py-2 px-5 rounded-lg text-base text-white hover:text-white' %>