Skip to content

Instantly share code, notes, and snippets.

Daigo <3 Dango zunda

Block or report user

Report or block zunda

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zunda
zunda / gist:45330d4cf860deae275a8474aedf1ccc
Created Jul 29, 2019
Duplicate tags for mastodon.zunda.ninja as of 2019-07-28 22:00 UTC
View gist:45330d4cf860deae275a8474aedf1ccc
> SELECT *
FROM tags
WHERE name IN (SELECT name FROM tags GROUP BY name HAVING COUNT(1) > 1)
ORDER BY name, id;
id | name | created_at | updated_at
-------+----------------------------------------+----------------------------+----------------------------
4937 | いろいろな人 | 2017-10-26 11:59:16.133449 | 2017-10-26 11:59:16.133449
33390 | いろいろな人 | 2018-12-20 16:22:53.403368 | 2018-12-20 16:22:53.403368
4371 | 今日から使える実用ドイツ語 | 2017-10-07 08:30:14.332968 | 2017-10-07 08:30:14.332968
View remove-dup-tags.rake
namespace :db do
desc 'Merge duplicate tags'
task remove_dup_tags: :environment do
ActiveRecord::Base.transaction do
con = ActiveRecord::Base.connection
dup_ids = con.select_rows(<<-'_SQL'
SELECT JSON_AGG(id ORDER BY id) AS ids
FROM tags
WHERE name IN (SELECT name FROM tags GROUP BY name HAVING COUNT(1) > 1)
GROUP BY name;
@zunda
zunda / db:migration.log
Created Jul 28, 2019
AddCaseInsensitiveIndexToTags (20190726175042)へのマイグレーションが失敗します
View db:migration.log
Migrating to AddCaseInsensitiveIndexToTags (20190726175042)
== 20190726175042 AddCaseInsensitiveIndexToTags: migrating ====================
-- execute("CREATE UNIQUE INDEX CONCURRENTLY index_tags_on_name_lower ON tags (lower(name))")
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
PG::UniqueViolation: ERROR: could not create unique index "index_tags_on_name_lower"
DETAIL: Key (lower(name::text))=(ドット絵) is duplicated.
: CREATE UNIQUE INDEX CONCURRENTLY index_tags_on_name_lower ON tags (lower(name))
@zunda
zunda / diff.patch
Created Apr 21, 2019
14.04からdo-release-upgradeで16.04にする途中で止めた時の/etc/aptの変化
View diff.patch
$ diff -ur apt apt-190420
diff -ur apt/apt.conf.d/01autoremove-kernels apt-190420/apt.conf.d/01autoremove-kernels
--- apt/apt.conf.d/01autoremove-kernels 2019-04-05 15:01:41.411360535 +0900
+++ apt-190420/apt.conf.d/01autoremove-kernels 2019-04-21 14:55:50.790500697 +0900
@@ -1,26 +1,26 @@
// DO NOT EDIT! File autogenerated by /etc/kernel/postinst.d/apt-auto-removal
APT::NeverAutoRemove
{
- "^linux-image-3\.13\.0-167-generic$";
+ "^linux-image-3\.13\.0-165-generic$";
View gist:19162442ae84256633becb1f273795ee
102 TID-oqyvw7cya WARN: {"context":"scheduler"}
102 TID-oqyvw7cya WARN: NoMethodError: undefined method `call' for nil:NilClass
102 TID-oqyvw7cya WARN: /app/app/lib/request_pool.rb:26:in `try_create'
/app/vendor/bundle/ruby/2.6.0/gems/connection_pool-2.2.2/lib/connection_pool/timed_stack.rb:83:in `block (2 levels) in pop'
/app/vendor/bundle/ruby/2.6.0/gems/connection_pool-2.2.2/lib/connection_pool/timed_stack.rb:79:in `loop'
/app/vendor/bundle/ruby/2.6.0/gems/connection_pool-2.2.2/lib/connection_pool/timed_stack.rb:79:in `block in pop'
/app/vendor/bundle/ruby/2.6.0/gems/connection_pool-2.2.2/lib/connection_pool/timed_stack.rb:78:in `synchronize'
/app/vendor/bundle/ruby/2.6.0/gems/connection_pool-2.2.2/lib/connection_pool/timed_stack.rb:78:in `pop'
/app/vendor/bundle/ruby/2.6.0/gems/sidekiq-5.2.5/lib/sidekiq/scheduled.rb:168:in `initial_wait'
/app/vendor/bundle/ruby/2.6.0/gems/sidekiq-5.2.5/lib/sidekiq/scheduled.rb:65:in `block in start'
@zunda
zunda / gist:658dae12b9ec8ada653343015a18b025
Created Jan 6, 2019
Mastodonがタグのタイムラインを構築している
View gist:658dae12b9ec8ada653343015a18b025
13:43:42 web.1 | Started GET "/api/v1/timelines/tag/thisisthetag" for 127.0.0.1 at 2019-01-06 13:43:42 -1000
13:43:42 web.1 | Processing by Api::V1::Timelines::TagController#show as HTML
13:43:42 web.1 | Parameters: {"id"=>"thisisthetag"}
13:43:42 web.1 | Doorkeeper::AccessToken Load (0.4ms) SELECT "oauth_access_tokens".* FROM "oauth_access_tokens" WHERE "oauth_access_tokens"."token" = $1 LIMIT $2 [["token", "79d80f8feb192b6932f261239ee1554e1e353e01fda59d3138c990800d10098f"], ["LIMIT", 1]]
13:43:42 web.1 | User Load (1.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
13:43:42 web.1 | SessionActivation Load (0.4ms) SELECT "session_activations".* FROM "session_activations" WHERE "session_activations"."session_id" = $1 LIMIT $2 [["session_id", "4a0b3d5240015ee1e8a2f5710746cbe2"], ["LIMIT", 1]]
13:43:42 web.1 | Tag Load (0.5ms) SELECT "tags".* FROM "tags" WHERE "tags"."name" = $1 LIMIT $2 [["name", "thisisthetag"], ["LI
@zunda
zunda / prepare-and-start.txt
Last active Nov 22, 2018
macOSでMastodonを走らせてみる
View prepare-and-start.txt
入れるのが大変なGemは入れない:
$ curl -o - https://gist.githubusercontent.com/zunda/c5f50abc1a2139d0edc1a3e6ddae2c84/raw/2a825d75fa64e5986abf685a091fc9c3ee3bdedf/run-mastodon-on-macos.patch | patch
PostgreSQLを走らせておいて、
$ export RAILS_ENV=development
$ bundle install --path=vendor/bundle
$ bundle exec rake assets:precompile
$ bundle exec rake db:drop
View rails-db-setup-backtrace.without-bootsnap.txt
/home/zunda/src/github.com/zunda/rails-dbmigrate-test/vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/lib/ffi/library.rb:275: [BUG] Segmentation fault at 0x0000005500000020
ruby 2.5.3p105 (2018-10-18 revision 65156) [aarch64-linux]
-- Control frame information -----------------------------------------------
c:0112 p:---- s:0583 e:000582 CFUNC :attach
c:0111 p:0255 s:0577 e:000576 METHOD /home/zunda/src/github.com/zunda/rails-dbmigrate-test/vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/lib/ffi/library.rb:275
c:0110 p:0064 s:0557 E:001af0 CLASS /home/zunda/src/github.com/zunda/rails-dbmigrate-test/vendor/bundle/ruby/2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/native.rb:
c:0109 p:0007 s:0554 E:001b60 CLASS /home/zunda/src/github.com/zunda/rails-dbmigrate-test/vendor/bundle/ruby/2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/native.rb:
c:0108 p:0014 s:0551 E:002420 TOP /home/zunda/src/github.com/zunda/rails-dbmigrate-test/vendor/bundle/ruby/2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/native.rb: [FINISH]
c:0107 p:---- s:0
View rails-db-setup-backtrace.txt
/home/zunda/src/github.com/zunda/rails-dbmigrate-test/vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/lib/ffi/library.rb:275: [BUG] Segmentation fault at 0x0000005500000020
ruby 2.5.3p105 (2018-10-18 revision 65156) [aarch64-linux]
-- Control frame information -----------------------------------------------
c:0134 p:---- s:0709 e:000708 CFUNC :attach
c:0133 p:0255 s:0703 e:000702 METHOD /home/zunda/src/github.com/zunda/rails-dbmigrate-test/vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/lib/ffi/library.rb:275
c:0132 p:0064 s:0683 E:001920 CLASS /home/zunda/src/github.com/zunda/rails-dbmigrate-test/vendor/bundle/ruby/2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/native.rb:
c:0131 p:0007 s:0680 E:001990 CLASS /home/zunda/src/github.com/zunda/rails-dbmigrate-test/vendor/bundle/ruby/2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/native.rb:
c:0130 p:0014 s:0677 E:001f10 TOP /home/zunda/src/github.com/zunda/rails-dbmigrate-test/vendor/bundle/ruby/2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/native.rb: [FINISH]
c:0129 p:---- s:0
@zunda
zunda / 01-heroku-18-without-libssl-dev.txt
Last active Aug 2, 2018
Heroku-18でAptfileにlibssl-devを含めてMastodonをビルドするとSEGVをもらうが、Heroku-16経由でビルドあるいはlibssl-devを除いてビルドするともらわない
View 01-heroku-18-without-libssl-dev.txt
$ ldd vendor/bundle/ruby/2.5.0/gems/puma-3.11.4/lib/puma/puma_http11.so
linux-vdso.so.1 (0x00007ffca71e9000)
libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f6c86954000)
libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f6c864dc000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6c862bd000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6c85ecc000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6c85cc8000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6c86dc8000)
You can’t perform that action at this time.