Skip to content

Instantly share code, notes, and snippets.

Coro Coro365

Block or report user

Report or block Coro365

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Coro365
Coro365 / 2019_ncov_json.rb
Created Feb 6, 2020
Json format for 2019-nCoV from Google Spread Sheets
View 2019_ncov_json.rb
# 2019_ncov_json.rb create json format for 2019-nCoV from Google Spread Sheets
# Thanks
# https://docs.google.com/spreadsheets/d/1wQVypefm946ch4XDp37uZ-wartW4V7ILdg-qYiDXUHM/htmlview?usp=sharing&sle=true
# https://gisanddata.maps.arcgis.com/apps/opsdashboard/index.html#/bda7594740fd40299423467b48e9ecf6
require 'open-uri'
require 'json'
require 'pp'
module GoogleSpreadSheet
@Coro365
Coro365 / natural_sort.rb
Created Dec 14, 2019
Rearrange arrays naturally
View natural_sort.rb
require 'pp'
module Natural_sort
def natural_sort
zero_length = max_num_length_of(self)
number_formated_names = self.map do |data|
name_array = data.scan(/(\D*)(\d+)(\D*)/).flatten.reject(&:empty?)
name_array = [data] if name_array.empty?
@Coro365
Coro365 / aterm-router-reboot.sh
Created Dec 2, 2019
Reboot aterm router (ATERM-DD3B55)
View aterm-router-reboot.sh
#!/bin/sh
# @(#) Reboot aterm router.
# @(#) shell script version: 20191202
# @(#) Test router is ATERM-DD3B55 (FW: 1.8.56)
user=YOUR_USERNAME
pass=YOUR_PASSWORD
domain=http://192.168.0.1
path=index.cgi/reboot_main_set
@Coro365
Coro365 / iTunes.sh
Last active Nov 16, 2019
This script iTunes(Music.app) play, pause, next track, back track and return state.
View iTunes.sh
#!/bin/sh
# @(#) This script Music.app play, pause, next track, back track and return state.
# @(#) Support macOS Catalina version.20191116
if [ -z "$1" ]; then
echo "Argument is missing!"
exit 1
elif [ "$1" == "play" ]; then
music_run=`osascript -e 'application "Music" is running'`
@Coro365
Coro365 / cue-for-youtube-setlist.rb
Last active Sep 1, 2019
Generate cue file for youtube comment setlist
View cue-for-youtube-setlist.rb
# How to
# Meke audio file and comment file
# ex. ~/audio.wav and ~/audio.txt
# Run `ruby cue-for-youtube-setlist.rb artist_name audio.wav`
# Generated ~/audio.cue
def to_index(time)
t = time.split(":").map { |e| e.to_i }
s, m, h = t.reverse
m = h * 60 + m if h
@Coro365
Coro365 / chapter-for-youtube-setlist.rb
Created Sep 1, 2019
Generate chapter.ini file for youtube comment setlist
View chapter-for-youtube-setlist.rb
# How to
# Meke video file and comment file and video length
# ex. ~/video.mp4 and ~/video.txt
# Run `ruby chapter-for-youtube-setlist.rb 1:23:23 video.txt`
# Generated ~/video.ini
# Run `ffmpeg -i ふろうふしのうた-Zw4bukluYcI.mp4 -i ふろうふしのうた-Zw4bukluYcI.ini -map_metadata 1 -c copy /ふろうふしのうた-Zw4bukluYcI-add-cap.mp4`
def to_ms(time)
t = time.split(":").map { |e| e.to_i }
s, m, h = t.reverse
@Coro365
Coro365 / find_duplicate_songs.rb
Last active Jul 20, 2019
Display the duplicate rows in the first column of the specified public Google Spread Sheet
View find_duplicate_songs.rb
# 指定したパブリックな Google Spread Sheet の1列目の値が重複した行を表示します
gss_url = "https://docs.google.com/spreadsheets/d/1iq_4d5ECOO6p5c3zJJg_mUMBNTPWbUzxGTxrNwGh8zs/htmlview?usp=sharing&sle=true"
def download_ggs(gss_url)
gss_html = `curl -# #{gss_url}`
ptt = /<div class="row-header-wrapper" style="line-height: 20px;">(\d*?)<\/div><\/th><td class.*?>(.*?)<\/td>/
ggs = gss_html.scan(ptt)
end
id_and_song = download_ggs(gss_url)
View keybase.md

Keybase proof

I hereby claim:

  • I am coro365 on github.
  • I am coro365 (https://keybase.io/coro365) on keybase.
  • I have a public key ASCKp7DefhT8lYmVe96KS0HhAzp8ZrnTjKfwbhAQMKBxxAo

To claim this, I am signing this object:

@Coro365
Coro365 / light_brightness_and_color.rb
Last active Feb 16, 2019
Control of brightness and color temperature in 10 steps (https://www.instagram.com/p/Bt8dhKcAxaJ/)
View light_brightness_and_color.rb
def initialize_state
$color_state_file = "#{__dir__}/color_state_file"
$brightness_state_file = "#{__dir__}/brightness_state_file"
update_color_state(10) unless FileTest.exist?($color_state_file)
update_brightness_state(10) unless FileTest.exist?($brightness_state_file)
$color_state = File.read($color_state_file).to_i
$brightness_state = File.read($brightness_state_file).to_i
end
@Coro365
Coro365 / air_purifier.rb
Last active Jan 13, 2019
Control air purifier by servo motor (Panasonic F-VX501)
View air_purifier.rb
def initialize_state
$mode_state_file = "#{__dir__}/mode_state_file"
$power_state_file = "#{__dir__}/power_state_file"
update_mode_state(1) unless FileTest.exist?($mode_state_file)
update_power_state(1) unless FileTest.exist?($power_state_file)
$mode_state = File.read($mode_state_file).to_i
$power_state = File.read($power_state_file).to_i
$mode_name = ["low", "mid", "high", "auto"]
end
You can’t perform that action at this time.