Skip to content

Instantly share code, notes, and snippets.

@zunda
zunda / primedate.rb
Last active January 25, 2023 19:13
拡張素数日
#!/usr/bin/ruby
#
# Copyright 2023 zunda <zundan at gmail.com>
#
# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.
#
require 'prime'
@zunda
zunda / Makefile
Last active February 6, 2023 21:33
Change in known accounts on a Mastodon server around November 2022
default: created_at.png daily.png gedan.png daily-all.png updated_at.png hourly.png
created_at.txt:
heroku pg:psql -c "SELECT created_at,updated_at FROM accounts WHERE actor_type='Person';" -a zundan-mastodon > $@
created_at.dat: created_at.txt
awk '/[0-9][0-9]:[0-9][0-9]/{if($$1 > 2015 && $$1 < 2030){print $$1,$$2}}' $< | sort > $@
updated_at.dat: created_at.txt
awk '/[0-9][0-9]:[0-9][0-9]/{if($$4 > 2015 && $$4 < 2030){print $$4,$$5}}' $< | sort > $@
@zunda
zunda / log.txt
Created November 21, 2022 19:50
ConnectionPool::TimeoutError
Nov 21 19:44:56 { 512860 rufus-scheduler intercepted an error:
Nov 21 19:44:56 512860 job:
Nov 21 19:44:56 512860 Rufus::Scheduler::IntervalJob "1 minute" {:job=>true, :tags=>["accounts_statuses_cleanup_scheduler"]}
Nov 21 19:44:56 512860 ["/app/vendor/bundle/ruby/3.1.0/gems/sidekiq-scheduler-4.0.3/lib/sidekiq-scheduler/scheduler.rb", 244]
Nov 21 19:44:56 512860 error:
Nov 21 19:44:56 512860 512860
Nov 21 19:44:57 512860 ConnectionPool::TimeoutError
Nov 21 19:44:57 512860 Waited 1 sec, 0/9 available
Nov 21 19:44:57 512860 /app/vendor/bundle/ruby/3.1.0/gems/connection_pool-2.3.0/lib/connection_pool/timed_stack.rb:77:in `block (2 levels) in pop'
Nov 21 19:44:57 512860 /app/vendor/bundle/ruby/3.1.0/gems/connection_pool-2.3.0/lib/connection_pool/timed_stack.rb:69:in `loop'
@zunda
zunda / log.txt
Created November 20, 2022 02:34
メディア付きのトゥートが配達されてきた時のMastodonからのアプリケーションログ
2022-11-20T02:26:53.132238+00:00 app[web.1]: [0a4d7307-26a5-484b-9f95-0c0a16f9fbab] method=POST path=/inbox format=html controller=ActivityPub::InboxesController action=create status=202 duration=32.37 view=0.00 db=2.65 key=https://example.com/users/1234#main-key
2022-11-20T02:26:53.264225+00:00 app[web.1]: pid=68 tid=5hn9g class=ActivityPub::ProcessingWorker jid=069032ce1e97cc06b3b9f1b9 INFO: start
2022-11-20T02:26:54.161984+00:00 app[web.1]: pid=68 tid=5ghac class=DistributionWorker jid=30e48cd1f29349bfa8bb75df INFO: start
2022-11-20T02:26:54.215904+00:00 app[web.1]: pid=68 tid=5hgpc class=ActivityPub::ProcessingWorker jid=223f82bd70808e5d81cddd1c elapsed=1.671 INFO: done
2022-11-20T02:26:54.272123+00:00 app[web.1]: pid=68 tid=5hu94 class=ActivityPub::ProcessingWorker jid=b72ebc58e8727b6aa40e1375 elapsed=1.93 INFO: done
2022-11-20T02:26:54.310909+00:00 app[web.1]: pid=68 tid=5hgpc class=FeedInsertWorker jid=c156e12d4b57324400a467ec INFO: start
2022-11-20T02:26:54.360970+00:00 app[web.1]: pid=68 tid=5ghac cl
@zunda
zunda / value-domain.sh
Last active January 25, 2023 19:14
某DNSプロパイダインスパイアの金盾確認コマンド
#!/bin/sh
#
# usage: value-domain example.com
#
# tests if the domain is blocked by the great firewall
#
# Copyright 2022 zunda <zundan at gmail.com>
#
# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
@zunda
zunda / log.txt
Created July 9, 2022 07:44
Sidekiqを6.4.2から6.5.1に上げた時にruby-3.1.2のMastodonで見られる例外
2022-07-09T07:37:08.775204+00:00 app[web.1]:
pid=68 tid=2h4w class=ActivityPub::DeliveryWorker jid=a67bc00b58725d5a4f8d0c92 elapsed=5.05 INFO: fail
pid=68 tid=2h4w WARN: {"context":"Job raised exception","job":{"retry":16,"queue":"push","dead":false,"class":"ActivityPub::DeliveryWorker","args":["{\"@context\":[\"https://www.w3.org/ns/activitystreams\",{\"ostatus\":\"http://ostatus.org#\",\"atomUri\":\"ostatus:atomUri\",\"inReplyToAtomUri\":\"ostatus:inReplyToAtomUri\",\"conversation\":\"ostatus:conversation\",\"sensitive\":\"as:sensitive\",\"toot\":\"http://joinmastodon.org/ns#\",\"votersCount\":\"toot:votersCount\"}],\"id\":\"https://mastodon.zunda.ninja/users/zundan/statuses/108616209186149625/activity\",\"type\":\"Create\",\"actor\":\"https://mastodon.zunda.ninja/users/zundan\",\"published\":\"2022-07-09T07:30:24Z\",\"to\":[\"https://www.w3.org/ns/activitystreams#Public\"],\"cc\":[\"https://mastodon.zunda.ninja/users/zundan/followers\"],\"object\":{\"id\":\"https://mastodon.zunda.ninja/users/zundan/statuse
@zunda
zunda / ojo.c
Created June 23, 2022 03:15
おっさんなのでCでお嬢様になる
#include <stdio.h>
#define ここの int
#define ご主人 main()
#define 様は以下のことをなさいます {
#define 以上ですわ }
#define お返しするのは return
#define でしてよ ;
#define 標準出力に表示させるのは(x) puts((x))
@zunda
zunda / each-cert.sh
Last active January 25, 2023 19:15
Run `openssl x509` on each of certificates obtained with `openssl s_client`
#
# Copyright 2022 zunda <zundan at gmail.com>
#
# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.
#
connectname=mastodon.zunda.ninja
servername=$connectname
@zunda
zunda / binary-pi.rb
Last active June 4, 2022 08:24
二進のπ
# 二進のπ
# Inspired from https://twitter.com/indozou/status/1520073427172093952
#
# Copyright 2022 <zundan at gmail.com>
#
# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.
class Numeric
@zunda
zunda / gist:1c5afcb06ac233f89e40728dfce7de4c
Last active May 3, 2022 18:55
ZundonにRedisを追加した
# アプリ名
ruby=zundan-mastodon
node=zundan-mastodon-streaming
# 別窓で
heroku logs -t -a $ruby & heroku logs -t -a $node &
# Redisへの書き込みを停止
date # Tue May 3 08:30:18 AM HST 2022
for a in $ruby $node; do heroku maintenance:on -a $a; done