- mastodon.example は適当な Mastodon サーバ
- xxxxx はAPIアクセストークン
予約投稿のリストを得る
curl https://mastodon.example/api/v1/scheduled_statuses -H 'Authorization: Bearer xxxxx`
指定したIDの予約投稿を消す (仮に 123 とする)
# crontab とかで 0:00 に実行するといい感じ | |
# encoding: utf-8 | |
require 'mastodon' | |
require 'date' | |
message = "らんだむに投稿されるよ" | |
url = "https://mastodon.example.com" | |
token = 'xxxxxx' |
予約投稿のリストを得る
curl https://mastodon.example/api/v1/scheduled_statuses -H 'Authorization: Bearer xxxxx`
指定したIDの予約投稿を消す (仮に 123 とする)
I hereby claim:
To claim this, I am signing this object:
require 'mastodon' # https://github.com/tootsuite/mastodon-api | |
message = '#hashtag' | |
pattern = '/path/to/image_files/*.jpg' | |
path = Dir.glob(pattern).sample | |
client = Mastodon::REST::Client.new(base_url: 'https://fedibird.com', bearer_token: ENV['MASTODON_TOKEN']) | |
media = client.upload_media(File.new(path)) |
# perl -MEncode -e 'my $str="\x{4ee4}";print Encode::encode("utf-8", $str);print "\n"' | |
# => 令 | |
# perl -MEncode -e 'my $str="\x{f9a8}";print Encode::encode("utf-8", $str);print "\n"' | |
# => 令 |
#!/usr/bin/env perl | |
# 2ファイルのうちお互いにしか無い行を抽出します。 | |
# | |
use strict; | |
use warnings; | |
use utf8; | |
use feature 'say'; | |
my $file_left = './left.txt'; | |
my $file_right = './right.txt'; |
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use utf8; | |
use LWP::UserAgent; | |
use Encode; | |
my $ua = LWP::UserAgent->new; | |
my $res = $ua->post( | |
'https://notify-api.line.me/api/notify', |
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use utf8; | |
use LWP::UserAgent; | |
use HTML::TreeBuilder; | |
use Encode; | |
use Data::Dumper; | |
my $url_base = 'http://hiroba.dqx.jp'; |
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Geo::IP; | |
my $ipaddr = $ARGV[0] || die "usage: geoip.pl <ip_addr>"; | |
my $gi = Geo::IP->open("/usr/local/share/GeoIP/GeoIP.dat", GEOIP_STANDARD); | |
my $country = $gi->country_code_by_addr($ipaddr); | |
print $ipaddr." 's country is ".$country."\n"; |
perl -e 'while(<index.html*>) { ($new = $_) =~ s/index\.html\?(.*)$/$1/; rename $_, $new }' |