This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# usage: to-path.sh files(to crop circle) | |
# | |
for path in "$@" | |
do | |
convert $path \( +clone -threshold -1 -negate -fill white -draw "circle `identify -format %w $path | awk '{print $1/2}'`, `identify -format %h $path | awk '{print $1/2}'` `identify -format %w $path | awk '{print $1/2}'`, 0" \) -alpha Off -compose copy_opacity -composite circle-`basename $path` | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rails basic configuration | |
environment_development_data = <<CODE | |
config.action_mailer.default_url_options = { host: 'http://localhost:3000' } | |
config.active_job.queue_adapter = :good_job | |
CODE | |
environment environment_development_data, env: 'development' | |
environment_production_data = <<CODE | |
config.action_mailer.default_url_options = { host: 'SET-YOUR-SERVICE-HOST-HERE' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: | |
# hash = { a: 1, b: { x: 'y'}, c: [{m: 10, n: 2}, { m: 20, n: 3} ] } | |
# hash.path('/a') => 1 | |
# hash.path('b/x') => 'y' | |
# hash.path('/c[0]/n') => 2 | |
# hash.path('/not/existent/key') => nil | |
# GenericUtils | |
module GenericSupport | |
module Pathable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: | |
# = render vc.path1.path2(:name, arg1: 'a') | |
# or | |
# = render vc('path1/path2/name', arg1: 'a') | |
module ViewComponentHelper | |
class VisualComponentChainer | |
def initialize | |
@nest = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for arg; do | |
dir=${arg} | |
# ffmpeg -framerate 60 -i $dir/seq%06d.jpg -vf deflicker=s=10:m=2 -c:v hevc_videotoolbox -b:v 200000k -tag:v hvc1 $dir.mp4 | |
ffmpeg -framerate 60 -pattern_type glob -i "$dir/seq*.jpg" -vf deflicker=s=10:m=2 -c:v hevc_videotoolbox -b:v 200000k -tag:v hvc1 $dir.mp4 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body(class=tw.text.px_4.py_2.hover__text_gray_200) | |
button(class=tw.btn.btn_primary) CLICK! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'jwt' | |
def generate_instant_token(topic, password: '') | |
sdk_key = ENV['ZOOM_SDK_KEY'] | |
sdk_secret = ENV['ZOOM_SDK_SECRET'] | |
iat = Time.now.to_i | |
exp = iat + 60 * 60 * 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t = 236 # seconds | |
Time.at(t).utc.strftime("%H:%M:%S") | |
=> "00:03:56" | |
# Reference | |
# http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list = `convert 9784152097712_10.jpg -format %c histogram:info:`.split("\n") | |
rgbs = list.map { |line| $1 if line =~ /\s+#([\dA-F]+)\s+/ } | |
num_non_gray = rgbs.select { |rgb| | |
r = rgb[0,2]; g = rgb[2,2]; b = rgb[4,2] | |
r != g || g != b | |
}.count | |
num_non_gray > 0 # true: 正しい画像, false: (一色かどうかはわからないが)グレー画像 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'request_store' |
NewerOlder