Skip to content

Instantly share code, notes, and snippets.

@zunda
zunda / paths.txt
Created February 20, 2024 02:59
Let's Encryptで証明書ができるとGETリクエストが来るパスの例
/
/.DS_Store
/.env
/.git/config
/.vscode/sftp.json
/?rest_route=/wp/v2/users/
/_all_dbs
/about
/config.json
/debug/default/view?panel=config
@zunda
zunda / log.sh
Last active December 13, 2023 23:06
ruby-masterでbootsnap
$ cd ~/c/src/github.com/ruby/ruby
$ git switch master
$ git pull
$ git rev-parse HEAD
31c0ea20e5492925ac971991937e30524da5043d
$ git clean -dxf
$ ./autogen.sh
$ mkdir build && cd build
$ mkdir ~/.rubies
$ ../configure --prefix="${HOME}/.rubies/ruby-master" --disable-install-doc
@zunda
zunda / log.txt
Created September 6, 2023 19:57
Mastodonがバックトレースをぜんぶ記録するようになっちゃった
pid=65 tid=742h WARN: Stoplight::Error::RedLight: https://example.com/inbox
pid=65 tid=742h WARN: /app/vendor/bundle/ruby/3.2.0/gems/stoplight-3.0.2/lib/stoplight/light/runnable.rb:50:in `run_red'
/app/vendor/bundle/ruby/3.2.0/gems/stoplight-3.0.2/lib/stoplight/light/runnable.rb:25:in `run'
/app/app/workers/activitypub/delivery_worker.rb:75:in `perform_request'
/app/app/workers/activitypub/delivery_worker.rb:36:in `perform'
/app/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.9/lib/sidekiq/processor.rb:202:in `execute_job'
/app/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.9/lib/sidekiq/processor.rb:170:in `block (2 levels) in process'
/app/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.9/lib/sidekiq/middleware/chain.rb:177:in `block in invoke'
/app/vendor/bundle/ruby/3.2.0/gems/sidekiq-unique-jobs-7.1.29/lib/sidekiq_unique_jobs/middleware.rb:36:in `call'
/app/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.9/lib/sidekiq/middleware/chain.rb:179:in `block in invoke'
@zunda
zunda / crawl-activitypub.rb
Last active January 31, 2024 22:02
crawler to measure size distribution of ActivityPub servers
#
# crawler to measure size distribution of ActivityPub servers
#
# usage: ruby crawl-activitypub.rb [initial-hostname]
# Creates a TSV file: apstat-%Y%m%d.tsv
#
# Copyright 2023 by zunda
#
# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
@zunda
zunda / 00.patch
Created May 2, 2023 19:15
Zundonにmp3をアップロードしようとした時のバックトレース May 02 19:09:14 UTC
index 288f847f17..a309c3f929 100644
--- a/app/controllers/api/v2/media_controller.rb
+++ b/app/controllers/api/v2/media_controller.rb
@@ -6,7 +6,10 @@ class Api::V2::MediaController < Api::V1::MediaController
render json: @media_attachment, serializer: REST::MediaAttachmentSerializer, status: @media_attachment.not_processed? ? 202 : 200
rescue Paperclip::Errors::NotIdentifiedByImageMagickError
render json: file_type_error, status: 422
- rescue Paperclip::Error
+ rescue Paperclip::Error => e
+ Rails.logger.error 'Paperclip::Error'
@zunda
zunda / .ruby-version
Last active May 29, 2023 20:48
Crawl rel="me" links
3.2.1
@zunda
zunda / inspect-marshal-dump.rb
Last active March 17, 2023 01:50
Trying to parse marshaled object
# https://docs.ruby-lang.org/ja/latest/doc/marshal_format.html
class MarshalDump
class DumpedClass
attr_reader :class_name, :parent, :ivars, :dump
def initialize(class_name)
@class_name = class_name
end
def set_parent(parent)
@zunda
zunda / Cached-status-2.txt
Last active March 9, 2023 01:16
500 error for GET at /api/v1/notifications on Mastodon (Ruby 3.2.1, with jemalloc, without JIT)
[
#<Status id: 109990660492246463, updated_at: "2023-03-09 01:11:27.314186000 +0000">,
#<Status id: 109990659522616557, updated_at: "2023-03-09 01:11:12.504444000 +0000">,
#<Status id: 109990659016836953, updated_at: "2023-03-09 01:11:04.784308000 +0000">,
#<Status id: 109990658036120775, updated_at: "2023-03-09 01:10:49.819764000 +0000">,
#<Status id: 109990654963086524, updated_at: "2023-03-09 01:10:02.929643000 +0000">,
#<Status id: 109990654029118138, updated_at: "2023-03-09 01:09:48.677304000 +0000">,
#<Status id: 109990652319990392, updated_at: "2023-03-09 01:09:22.598533000 +0000">,
#<Status id: 109990651465714016, updated_at: "2023-03-09 01:09:09.563808000 +0000">,
#<Status id: 109990650683468074, updated_at: "2023-03-09 01:08:57.628983000 +0000">,
Mar 01 21:38:23 zundan-mastodon app/web.1 [836588df-3229-4fdf-9d96-9e0ed7cfc9a5] method=GET path=/api/v1/timelines/home format=html controller=Api::V1::Timelines::HomeController action=show status=500 error='NoMethodError: undefined method `fetch_value' for nil:NilClass' duration=141.40 view=0.00 db=7.84
Mar 01 21:38:23 zundan-mastodon app/web.1 raw :[#<Status id: 109950175935800081, updated_at: "2023-03-01 21:35:42.086177000 +0000">, #<Status id: 109950173107058155, updated_at: "2023-03-01 21:34:58.829075000 +0000">, #<Status id: 109950172413903709, updated_at: "2023-03-01 21:34:48.252018000 +0000">, #<Status id: 109950172331910407, updated_at: "2023-03-01 21:34:46.997444000 +0000">, #<Status id: 109950166150415336, updated_at: "2023-03-01 21:33:12.678209000 +0000">, #<Status id: 109950160495629085, updated_at: "2023-03-01 21:31:46.398973000 +0000">, #<Status id: 109950156699227352, updated_at: "2023-03-01 21:30:48.464499000 +0000">, #<Status id: 109950152411121701, updated_at: "2023-03-01 21:29:43.032951000
@zunda
zunda / togetter-tweets.rb
Last active January 25, 2023 19:12
ブラウザから保存したTogetterさんのページからツイートを抽出してタブ区切りファイルとして整形する
#!/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 'time'