Skip to content

Instantly share code, notes, and snippets.

View moreta's full-sized avatar

JungJoo Seo moreta

  • Brakio
  • Japan
View GitHub Profile
@moreta
moreta / sssh
Created February 9, 2012 16:39
sssh(ssh自動ログイン)
#!/bin/sh
# 実行例1:sssh を実行すると ~/bin/server_list の一覧からserver選択して自動ssh接続
# 実行例2:sssh $server を実行すると ssh $ssh_user@$server を実行する
ssh_user="ssh user"
ssh_pass="ssh password"
ssh_login(){
if [ $# -ne 1 ]; then
class CreatePdmRevisions < ActiveRecord::Migration
def self.up
create_table :pdm_revisions do |t|
t.column :commit_message, :string
t.column :attachment, :string
t.column :created_by, :string
t.column :created_date, :datetime
t.column :document_type, :string
t.column :pdm_document_id, :int
end
@moreta
moreta / tableless.rb
Created October 29, 2012 12:22 — forked from matpowel/tableless.rb
An ActiveRecord emulating Tableless model which works with Rails 3.1
class Tableless < ActiveRecord::Base
def self.column(name, sql_type = nil, default = nil, null = true)
columns << ActiveRecord::ConnectionAdapters::Column.new( name.to_s, default, sql_type.to_s, null )
end
def self.columns()
@columns ||= [];
end
@moreta
moreta / commit-msg
Last active August 29, 2015 13:57 — forked from EmmanuelOga/commit-msg
#!/usr/bin/env ruby
#
# Git commit-msg hook. If your branch name is in the form "US1234-postfix", or
# "US1234_postfix", it automatically adds the prefix "[US1234]" to commit
# messages.
#
# Example
# =======
#
# git checkout -b US1234-some-cool-feature
require "github_api"
# スター数を知りたいリポジトリ user/name
repos = %W{
allaboutapps/A3GridTableView
AlanQuatermain/AQGridView
norsez/BDDynamicGridViewController
hirohisa/BrickView
phranck/CNGridView
gmoledina/GMGridView
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "VPC knowhow template",
"Parameters": {
"KeyName": {
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instances",
"Type": "String",
"MinLength": "1",
"MaxLength": "64",
"AllowedPattern": "[-_ a-zA-Z0-9]*",
@moreta
moreta / call_rake.rb
Last active August 29, 2015 14:14
rake run code for example from rails controller
def call_rake(task, options = {})
options[:rails_env] = Rails.env
args = options.map { |n, v| "#{n.to_s.upcase}='#{v}'" }
system "bundle exec rake #{task} #{args.join(' ')} >> #{Rails.root}/log/rake.log &"
end
@moreta
moreta / gw-kit.sh
Last active August 29, 2015 14:28
kerberos 인증 및 rlogin을 위한 gateway용 스크립트
#!/bin/bash
#==============================================================================
# GW-Kit
# @author : yunsang.choi(oddpoet@gmail.com)
# @src : https://gist.github.com/gists/3115022
#-------
# v1.3.4
# - minor change (display text)
# v1.3.3
# - allow '-' character in hostname
@moreta
moreta / convert-seconds-into-date-format-in-ruby.rb
Last active December 15, 2015 03:53 — forked from shunchu/convert-seconds-into-hh-mm-ss-in-ruby.rb
Convert seconds into HH:MM:SS or date format in Ruby
# seconds
t = 236
Time.at(t).utc.strftime("%H:%M:%S")
=> "00:03:56"
# unix time
t = 1450236594
Time.at(t).utc.strftime("%Y/%d/%d %H:%M:%S")
=> "03:29:54"
@moreta
moreta / Demo.vue
Created February 25, 2019 16:18 — forked from Akryum/Demo.vue
vue-responsive
<template>
<div>
<div v-if="$responsive.mobile">Mobile</div>
<div v-else-if="$responsive.tablet">Tablet</div>
<div v-else>Desktop</div>
</div>
</template>