Skip to content

Instantly share code, notes, and snippets.

@kei-p
kei-p / gen_pull_request_csv.rb
Last active January 11, 2024 02:19
generate pull request lists
# HOW TO USE:
# ruby gen_pull_request_csv.rb ownername/repo 2024-01-01
require 'json'
require 'csv'
@token = ENV.fetch('GH_TOKEN')
def run_api(path)
call = <<~CURL
@kei-p
kei-p / conv.rb
Last active October 27, 2023 01:39
whenever to good_job_cron
require 'whenever'
ENV['RAILS_ENV'] = 'production'
ENV['MASTER_HOST'] = Socket.gethostname
options = {
crontab_command: 'crontab',
file: 'config/schedule.rb',
}
output = Whenever::JobList.new(options).send(:cron_jobs)
def parse(match)
@kei-p
kei-p / generate_issue_csv.rb
Last active June 2, 2020 03:50
generate_issue_csv
require "net/http"
require "json"
require "csv"
require "time"
page = 1
def time_parse(time)
return unless time
#!/bin/bash
#
# (1) copy to: ~/bin/ssh-host-colorize
# (2) set: alias ssh=~/bin/ssh-host-colorize
#
set_term_bgcolor(){
local R=$1
local G=$2
local B=$3
# Usage:
# ruby <(curl -sL https://gist.githubusercontent.com/kei-p/28e117a8ea3c57959be6e106169fa834/raw/sound_roulette)
SOUNDS = %w(C C#/Db D D#/Eb E F F#/Gb G G#/Ab A A#/Bb B)
SOUNDS.shuffle.each do |sound|
print "#{sound} "
gets
end
puts 'END'
@kei-p
kei-p / Gemfile
Created November 30, 2016 06:07
markdown で作ったテストシートを xlsx に変換
source "https://rubygems.org"
gem 'redcarpet'
gem 'rubyXL'
@kei-p
kei-p / private.xml
Created November 28, 2016 00:28
[ Karabiner ] - vim で esc 押したときに常に かな => 英数 へ移行
<?xml version="1.0"?>
<root>
<appdef>
<appname>iTERM2</appname>
<equal>com.googlecode.iterm2</equal>
</appdef>
<appdef>
<appname>MACVIM</appname>
<equal>org.vim.MacVim</equal>
</appdef>
@kei-p
kei-p / activity.rb
Last active November 28, 2016 03:57
PublicActivity で 通知
class Activity < ::PublicActivity::Activity
has_many :notifications, dependent: :destroy
end
channel=$SLACK_CHANNEL
service_url=$SLACK_SERVICES
message="Hello World!!"
payload="{\"channel\": \"${channel}\", \"username\": \"slackman\", \"text\": \"${message}\", \"icon_emoji\": \":smile:\"}"
curl -X POST \
-H 'Content-type: application/json' \
--data "${payload}" \
${service_url}
@kei-p
kei-p / convert-padding-button
Last active October 26, 2016 07:05
Convert utils
#! /usr/bin/ruby
# Usage: convert-padding-button 3 "~/image/logo.png"
`which convert`
unless $? == 0
puts "Please install imagemagick"
puts "\t$ brew install imagemagick"
exit 1
end