Skip to content

Instantly share code, notes, and snippets.

View ywindish's full-sized avatar
🐈

Yamako ywindish

🐈
View GitHub Profile
@ywindish
ywindish / schedule.rb
Last active June 21, 2023 07:12
Mastodonに毎日ランダムな時間で予約投稿するbot
# crontab とかで 0:00 に実行するといい感じ
# encoding: utf-8
require 'mastodon'
require 'date'
message = "らんだむに投稿されるよ"
url = "https://mastodon.example.com"
token = 'xxxxxx'
@ywindish
ywindish / keybase.md
Created January 4, 2021 14:13
for keybase

Keybase proof

I hereby claim:

  • I am ywindish on github.
  • I am yamako (https://keybase.io/yamako) on keybase.
  • I have a public key ASByHnN_BuC5uqi_ZuK2WcN6MDzLNuzt67VIBdKigyv3Qwo

To claim this, I am signing this object:

@ywindish
ywindish / gist:2155288
Created March 22, 2012 02:44
Perlのオブジェクト指向なコードを書いてみる
#
# Perlのオブジェクト指向なコードを書いてみる
# http://codepad.org/z5axBdJP
#
use strict;
use warnings;
# 名前空間(パッケージ)の宣言。
# すべてのパッケージは暗黙のルートパッケージ main に属する。
package PerlOop;
@ywindish
ywindish / delete_scheduled_status.md
Created December 7, 2021 09:21
curl で Mastodon の予約投稿を削除する
  • mastodon.example は適当な Mastodon サーバ
  • xxxxx はAPIアクセストークン

予約投稿のリストを得る

curl https://mastodon.example/api/v1/scheduled_statuses -H 'Authorization: Bearer xxxxx`

指定したIDの予約投稿を消す (仮に 123 とする)

@ywindish
ywindish / getwikis.php
Created July 9, 2015 05:01
Backlog Wiki をバックアップする
<?php
/**
* Backlog Wikiをローカルにバックアップします
* 要PHP5.3以降
* usage: php getwikis.php
* ref: https://github.com/atomita/backlog-v2
* todo: ファイル周りのエラー処理がないので誰か直してください..
*/
require "vendor/autoload.php";
use \atomita\Backlog;
@ywindish
ywindish / image_post_at_random.rb
Last active February 9, 2021 02:20
Images in folder be posted to Mastodon instance at random
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))
@ywindish
ywindish / gist:af8580973ca9487c25c78d338a4285bf
Created April 10, 2019 06:01
Perl one-liner: Unicode code point converted to a character
# 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"'
# => 令
@ywindish
ywindish / line_notifiy_sample.pl
Last active May 7, 2018 08:59
LINE Notify sample code
#!/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',
@ywindish
ywindish / 2file_unique.pl
Created July 13, 2017 03:01
2ファイルのうちお互いにしか無い行を抽出する
#!/usr/bin/env perl
# 2ファイルのうちお互いにしか無い行を抽出します。
#
use strict;
use warnings;
use utf8;
use feature 'say';
my $file_left = './left.txt';
my $file_right = './right.txt';
@ywindish
ywindish / teian_reader.pl
Last active October 13, 2016 06:37
TeianReader
#!/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';