Skip to content

Instantly share code, notes, and snippets.

@pooza
pooza / purgeMails.gas
Last active February 14, 2020 21:35
Gmail上で、bulkラベルのついた古いメールを削除。
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 December 9, 2019 12:36
実況隠すやつ

実況隠すやつ

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

機能

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

動作環境

#!/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

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 February 7, 2019 10:16
.circleci/config.yml
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'),
)
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
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}})
@pooza
pooza / growi.god
Last active January 21, 2019 06:32
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'
@pooza
pooza / accounts.sql
Last active December 7, 2018 01:31
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 November 6, 2018 02:23
mastodon=# SELECT id,url,uri FROM statuses ORDER BY created_at DESC LIMIT 10;
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