Upgrade to Pro — share decks privately, control downloads, hide ads and more …

画像自動保存・閲覧システム「救い」によってもたらされる効能; 死にゆくTwitter Stre...

画像自動保存・閲覧システム「救い」によってもたらされる効能; 死にゆくTwitter Streaming APIへの別れの言葉を添えて / Sukui as a Service

KMC春合宿講座2018

utagawa kiki

March 16, 2018
Tweet

More Decks by utagawa kiki

Other Decks in Programming

Transcript

  1. import json import requests payload = { "username": "hogefuga", "text":

    "yo" } requests.post( "https://hooks.slack.com/services/hoge/fuga/waowaowao", data=json.dumps(payload) )
  2. select * from image_info where (something) order by id desc

    limit 200 offset 500000000 ൪໨Ͳ͜ʁ
  3. select * from ( select * from image_info where id

    > M order by id asc limit k ) as t order by id desc
  4. CREATE TABLE `image_info` ( `id` int(32) NOT NULL AUTO_INCREMENT, `image_id`

    int(32) DEFAULT NULL, `description` varchar(2048) DEFAULT NULL, `source` varchar(512) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `image_id` (`image_id`), KEY `source` (`source`) USING HASH, FULLTEXT KEY `description` (`description`) /*! 50100 WITH PARSER `ngram` */ , CONSTRAINT `image_info_ibfk_1` FOREIGN KEY (`image_id`) REFERENCES `images` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=121018 DEFAULT CHARSET=utf8mb4
  5. select * from image_info where match (description) against ('ΈΓ͋' in

    natural language mode)
 and description like '%ΈΓ͋%'
  6. select * from image_info where (FILL IN HERE) order by

    created_at desc limit 200 શؚͯΉ ΈΓ͋ ͍ͣΕؚ͔Ή ʹͳ ͪ͑ ͲΕ΋ؚ·ͳ͍ ΕΈΓ͋
  7. select * from image_info where true order by created_at desc

    limit 200 ͱΓ͋͑ͣUSVF શؚͯΉ ΈΓ͋ ͍ͣΕؚ͔Ή ʹͳ ͪ͑ ͲΕ΋ؚ·ͳ͍ ΕΈΓ͋
  8. select * from image_info where true and match (description) against

    ('ΈΓ͋' in natural language mode) and description like '%ΈΓ͋%' order by created_at desc limit 200 "/%ݕࡧ શؚͯΉ ΈΓ͋ ͍ͣΕؚ͔Ή ʹͳ ͪ͑ ͲΕ΋ؚ·ͳ͍ ΕΈΓ͋
  9. select * from image_info where true and match (description) against

    ('ΈΓ͋' in natural language mode) and description like '%ΈΓ͋%' and ((match (description) against ('ʹͳ' in natural language mode and description like '%ʹͳ%') or (match (description) against ('ͪ͑' in natural language mode and description like '%ͪ͑%')) order by created_at desc limit 200 03ݕࡧ શؚͯΉ ΈΓ͋ ͍ͣΕؚ͔Ή ʹͳ ͪ͑ ͲΕ΋ؚ·ͳ͍ ΕΈΓ͋
  10. select * from image_info where true and match (description) against

    ('ΈΓ͋' in natural language mode) and description like '%ΈΓ͋%' and ((match (description) against ('ʹͳ' in natural language mode and description like '%ʹͳ%') or (match (description) against ('ͪ͑' in natural language mode and description like '%ͪ͑%')) and description not like '%ΕΈΓ͋%' order by created_at desc limit 200 /05ݕࡧ શؚͯΉ ΈΓ͋ ͍ͣΕؚ͔Ή ʹͳ ͪ͑ ͲΕ΋ؚ·ͳ͍ ΕΈΓ͋
  11. select * from image_info where true and match (description) against

    ('ΈΓ͋' in natural language mode) and description like '%ΈΓ͋%' and ((match (description) against ('ʹͳ' in natural language mode and description like '%ʹͳ%') or (match (description) against ('ͪ͑' in natural language mode and description like '%ͪ͑%')) and description not like '%ΕΈΓ͋%' order by created_at desc limit 200 ׬੒ શؚͯΉ ΈΓ͋ ͍ͣΕؚ͔Ή ʹͳ ͪ͑ ͲΕ΋ؚ·ͳ͍ ΕΈΓ͋
  12. select * from image_info where true and match (description) against

    ('ΈΓ͋' in natural language mode) and description like '%ΈΓ͋%' and ((match (description) against ('ʹͳ' in natural language mode and description like '%ʹͳ%') or (match (description) against ('ͪ͑' in natural language mode and description like '%ͪ͑%')) and description not like '%ΕΈΓ͋%' order by created_at desc limit 200 ͔ͤͬ͘ͳͷͰؑ͝৆͍ͩ͘͞
  13. select * from image_info where true and match (description) against

    ('ΈΓ͋' in natural language mode) and description like '%ΈΓ͋%' and ((match (description) against ('ʹͳ' in natural language mode and description like '%ʹͳ%') or (match (description) against ('ͪ͑' in natural language mode and description like '%ͪ͑%')) and description not like '%ΕΈΓ͋%' order by created_at desc limit 200 ͔ͤͬ͘ͳͷͰؑ͝৆͍ͩ͘͞ ࠶ܝ
  14. w "1*PWFSWJFXUPPUTVJUFEPDVNFOUBUJPO w IUUQTHJUIVCDPNUPPUTVJUFEPDVNFOUBUJPOCMPCNBTUFS 6TJOHUIF"1*"1*NE w 1BXPP w IUUQTQBXPPOFUBCPVU w

    6TFUIF*OEFY -VLF w IUUQTVTFUIFJOEFYMVLFDPNKB w 0''4&5Λ࢖Θͳ͍ߴ଎ͳϖʔδωʔγϣϯͷ࣮ݱ w IUUQTRJJUBDPNNQZXJUFNTDDFFF