Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'date'
require 'pg'
# 設定
TARGET = 'zroot/postgres' # 対象パーティション
DAYS = 7 # 保管する日数
DSN = 'postgres://postgres@localhost/mastodon' # PG形式の接続文字列
def snapshots(target = TARGET)
@pooza
pooza / cognito.php
Last active May 13, 2024 03:48
AWS Cognito クライアントの初期化
<?php
$client = new Aws\CognitoIdentityProvider\CognitoIdentityProviderClient([
'version' => 'latest',
'region' => REGION,
'credentials' => [
'key' => IAM_ACCESS_KEY,
'secret' => IAM_SECRET_KEY,
],
]);
@pooza
pooza / ganbae.play.aiscript
Created November 28, 2023 00:06
ぷいきゅあがんばえーー!!
/// @ 0.15.1
// おみくじぷりせっといじったよ
// ぷいきゅあがんばえーー!!
// 選択肢
var mioo = [
"[光の使者、キュアブラック!](https://www.youtube.com/watch?v=maiX-2d4R3w)"
"[光の使者、キュアホワイト!](https://www.youtube.com/watch?v=maiX-2d4R3w)"
"[輝く命、シャイニールミナス! 光の心と光の意志、全てを一つにするために!](https://www.youtube.com/watch?v=sR-dT4UMC-w)"
"[輝く金の花! キュアブルーム!](https://www.youtube.com/watch?v=HcWHcS142Kw)"
#!/usr/bin/env ruby
dir = File.expand_path('..', __dir__)
$LOAD_PATH.unshift(File.join(dir, 'app/lib'))
ENV['BUNDLE_GEMFILE'] = File.join(dir, 'Gemfile')
URL = 'https://timetreeapis.com/calendars/__CALENDAR__/upcoming_events?timezone=Asia/Tokyo&days=7&include=attendees'
TOKEN = '__TOKEN__'
require 'tomato_shrieker'
module TomatoShrieker
today = ARGV.first ? Time.parse(ARGV.first).to_date : Date.today
@pooza
pooza / instance_check.rb
Created January 1, 2023 23:38
鯖のリストから、サ終していそうなところをふるいにかけるやつ
#!/usr/bin/env ruby
require 'resolv'
require 'httparty'
require 'timeout'
File.read('./instances.txt').each_line(chomp: true) do |domain|
Timeout.timeout(10) do
Resolv::DNS.new.getaddress(domain)
code = HTTParty.get("https://#{domain}/nodeinfo/2.0.json").code
raise '404' if code == 404
@pooza
pooza / info.md
Last active September 18, 2022 09:06
TimeTree Personal Access Token
@pooza
pooza / delicious-party.rb
Last active January 9, 2022 05:19
デパプリニュースページをJSON化
#!/usr/bin/env ruby
dir = File.expand_path('..', __dir__)
$LOAD_PATH.unshift(File.join(dir, 'app/lib'))
ENV['BUNDLE_GEMFILE'] = File.join(dir, 'Gemfile')
require 'mulukhiya'
ROOT_URL = 'https://www.toei-anim.co.jp/tv/delicious-party_precure/'.freeze
SOURCE_URL = 'https://www.toei-anim.co.jp/tv/delicious-party_precure/news/'.freeze
Dir.chdir(dir)
@pooza
pooza / epg_recording.rb
Last active April 19, 2022 08:29
EPGStationの録画開始を投稿する、TomatoShriekerプラグイン。
#!/usr/bin/env ruby
dir = File.expand_path('..', __dir__)
$LOAD_PATH.unshift(File.join(dir, 'app/lib'))
ENV['BUNDLE_GEMFILE'] = File.join(dir, 'Gemfile')
require 'tomato_shrieker'
module TomatoShrieker
class ::Integer
def to_time
return Time.at(self / 1000)
@pooza
pooza / epg_reserve.rb
Last active April 19, 2022 08:29
EPGStationの予約のうち、特定キーワードを含むものの要約を投稿する、TomatoShriekerプラグイン。
#!/usr/bin/env ruby
dir = File.expand_path('..', __dir__)
$LOAD_PATH.unshift(File.join(dir, 'app/lib'))
ENV['BUNDLE_GEMFILE'] = File.join(dir, 'Gemfile')
require 'tomato_shrieker'
module TomatoShrieker
class ::Integer
def to_time
return Time.at(self / 1000)
@pooza
pooza / dai_anniv.rb
Last active April 27, 2022 05:09
「ダイの大冒険」に関連した記念日を標準出力に出力。tomato-shriekerと組み合わせ、BOT化可能。
#!/usr/bin/env ruby
dir = File.expand_path('..', __dir__)
$LOAD_PATH.unshift(File.join(dir, 'app/lib'))
ENV['BUNDLE_GEMFILE'] = File.join(dir, 'Gemfile')
CHARACTER_URL = 'https://mstdn.delmulin.com/api/character/v1/detail.json'.freeze
ANNIVERSARY_URL = 'https://mstdn.delmulin.com/api/anniversary/v1/common.json'.freeze
require 'tomato_shrieker'
module TomatoShrieker