Skip to content

Instantly share code, notes, and snippets.

Tatsuya Koishi pooza

View GitHub Profile
@pooza
pooza / purgeMails.gas
Last active Feb 14, 2020
Gmail上で、bulkラベルのついた古いメールを削除。
View purgeMails.gas
function purgeMails () {
const days = 30
const step = 500
const labels = ['label:bulk']
const date = new Date()
date.setDate(date.getDate() - days)
labels.map(label => {
let offset = 0
let threads = GmailApp.search(label, offset, step)
@pooza
pooza / README.md
Last active Dec 9, 2019
実況隠すやつ
View README.md

実況隠すやつ

拙作モロヘイヤ3.1以降がインストールされているMastodonインスタンスで、 #実況 タグを含むトゥートを表示したり隠したりします。

機能

  • マイクアイコンをクリックしてその内容をトゥートすると、実況ON。
  • 斜線マイクアイコンをクリックしてその内容をトゥートすると、実況OFF。

動作環境

View instance_check.rb
#!/usr/bin/env ruby
require 'resolv'
require 'httparty'
require 'timeout'
File.read('./instances.txt').each_line(chomp: true) do |domain|
Timeout.timeout(10) do
Resolv::DNS.new.getaddress(domain)
code = HTTParty.get("https://#{domain}/about").code
raise '404' if code == 404
View keybase.md

Keybase proof

I hereby claim:

  • I am pooza on github.
  • I am pooza (https://keybase.io/pooza) on keybase.
  • I have a public key ASAIan-f3fnX_NBDfbks4BoFKcXzc6u7f_9La29EOT_QPgo

To claim this, I am signing this object:

@pooza
pooza / Rakefile
Created Feb 7, 2019
.circleci/config.yml
View Rakefile
dir = File.expand_path(__dir__)
namespace :cert do
desc 'update cert'
task :update do
require 'httparty'
File.write(
File.join(dir, 'cert/cacert.pem'),
HTTParty.get('https://curl.haxx.se/ca/cacert.pem'),
)
View config.rb
module MulukhiyaTootProxy
class Config < Ginseng::Config
include Package
def self.deep_merge(src, target)
raise ArgumentError 'Not Hash' unless target.is_a?(Hash)
dest = (src.clone || {}).with_indifferent_access
target.each do |k, v|
dest[k] = v.is_a?(Hash) ? deep_merge(dest[k], v) : v
end
View config_test.rb
module MulukhiyaTootProxy
class ConfigTest < Test::Unit::TestCase
def test_deep_merge
config = Config.deep_merge({}, {a: 111, b: 222})
assert_equal(config, {'a' => 111, 'b' => 222})
config = Config.deep_merge(config, {c: {d: 333, e: 444}})
assert_equal(config, {'a' => 111, 'b' => 222, 'c' => {'d' => 333, 'e' => 444}})
config = Config.deep_merge(config, {c: {e: 333, f: 444}})
assert_equal(config, {'a' => 111, 'b' => 222, 'c' => {'d' => 333, 'e' => 333, 'f' => 444}})
config = Config.deep_merge(config, {c: {d: nil}})
View growi.god
God.watch do |god|
god.name = 'growi'
god.env = {
'NODE_ENV' => 'production',
'MONGO_URI' => 'mongodb://localhost:27017/growi',
'PORT' => '3012',
'FILE_UPLOAD' => 'local',
'EIO_WS_ENGINE' => 'ws',
}
god.dir = '/home/pooza/growi'
View accounts.sql
SELECT
accounts.id
FROM accounts
LEFT JOIN users ON accounts.id=users.account_id
LEFT JOIN (
SELECT
account_id
FROM blocks
WHERE target_account_id=1
) AS blockers ON accounts.id=blockers.account_id
@pooza
pooza / result.txt
Created Nov 6, 2018
mastodon=# SELECT id,url,uri FROM statuses ORDER BY created_at DESC LIMIT 10;
View result.txt
mastodon=# SELECT id,url,uri FROM statuses ORDER BY created_at DESC LIMIT 10;
id | url | uri
--------------------+-----------------------------------------------------+-------------------------------------------------------------------
101021706725789900 | https://mstdn.b-shock.org/@pooza/101021706465667821 | https://mstdn.b-shock.org/users/pooza/statuses/101021706465667821
101021536613538389 | https://mstdn.b-shock.org/@pooza/101021536290247023 | https://mstdn.b-shock.org/users/pooza/statuses/101021536290247023
101021359813439899 | https://mstdn.b-shock.org/@pooza/101021359533523455 | https://mstdn.b-shock.org/users/pooza/statuses/101021359533523455
101020388883530247 | https://mstdn.b-shock.org/@pooza/101020385819933342 | https://mstdn.b-shock.org/users/pooza/statuses/101020385819933342
101018448167948034 | https://mstdn.b-shock.org/@pooza/101018447922314499 | https://mstdn.b-shock.org/users/pooza/statuses/1
You can’t perform that action at this time.