Skip to content

Instantly share code, notes, and snippets.

View ursm's full-sized avatar

Keita Urashima ursm

View GitHub Profile
ursm / Gemfile
Last active April 19, 2016 06:47
View Gemfile
source ''
gem 'pg'
gem 'sequel'
ursm / parse_st.rb
Last active March 14, 2016 12:37 — forked from tfuji/parse_st.rb
INSDC structured comment parser
View parse_st.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'bio'
def parse_st_comment(comment)
comment.scan(/##(.+)-START##\n(.*)\n##\1-END##/m).each_with_object({}) {|(tagset, block), memo|
i = 0
memo[tagset] = block.lines.chunk {|line|
View destruct_jsonapi.rb
class ActionController::Parameters
def destruct_jsonapi
data = fetch(:data)
relationships = data.fetch(:relationships) { }
attributes = self.class[*data.fetch(:attributes) { }.flat_map {|key, value|
[key.underscore, value]
relationships.each_with_object(attributes) {|(key, value), attrs|
ursm / rfb.rb
Created September 1, 2015 20:53
View rfb.rb
require 'json'
require 'nokogiri'
require 'open-uri'
def find_complete_row(doc, i)
prev = doc.at_css("#rgn_content4 tbody tr:nth-child(#{i.pred})").css('td').map(&:text)
prev.size == 10 ? prev : find_complete_row(doc, i.pred)
View system_bang.rb
require 'open3'
def system!(*args)
out, status = Open3.capture2e(*args)
raise RuntimeError, out unless status.success?
View activeadmin_aato_select2.rb
form do |f|
f.inputs do
f.input :name, input_html: {disabled: true}
f.input :tag_list, as: :select2_tags, collection: ActsAsTaggableOn::Tag.pluck(:name), input_html: {value: f.object.tag_list.to_s}
ursm /
Last active August 29, 2015 14:19


# cd /usr/src/linux
# make nconfig

Gentoo Linux  --->
  Support for init systems, system and service managers  --->
    [ ] OpenRC, runit and other script based systems and managers
 [*] systemd
`import Ember from 'ember'`
`import Session from 'simple-auth/session'`
makePromise = (promiseOrValue) ->
if promiseOrValue.then
AsyncSession = Session.extend
ursm / config.json
Created June 23, 2014 05:32
Custom bootstrap build configuration for Idoyuki
View config.json
"vars": {
"@gray-darker": "lighten(#000, 13.5%)",
"@gray-dark": "lighten(#000, 20%)",
"@gray": "lighten(#000, 33.5%)",
"@gray-light": "lighten(#000, 60%)",
"@gray-lighter": "lighten(#000, 93.5%)",
"@brand-primary": "#428bca",
"@brand-success": "#5cb85c",
"@brand-info": "#5bc0de",
View ansible-eyc-inventory
#!/usr/bin/env ruby
require 'json'
Instance =, :amazon_id, :role)
def environment
basename = File.basename(__FILE__)
unless basename.include?('@')