Skip to content

Instantly share code, notes, and snippets.

View mpyw's full-sized avatar
🏠
Working from home

mpyw mpyw

🏠
Working from home
View GitHub Profile
{
"extends": "standard",
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": false
},
"env": {
"browser": true,
"node": true,
@mpyw
mpyw / prune_log_streams.sh
Created September 8, 2018 12:03
古いログストリームを削除
#!/bin/bash
for group in $(aws logs describe-log-groups | jq -r '.logGroups[].logGroupName'); do
echo "Fetching: $group"
for stream in $(aws logs describe-log-streams --log-group-name "$group" | jq -r '
.logStreams[]
| select(.storedBytes == 0 and ($now|tonumber) - .creationTime / 1000 > 86400)
| .logStreamName
' --arg now $(date +%s)); do
echo "Deleting: $group $stream"
@mpyw
mpyw / qiita-trend-eliminator.user.js
Last active November 12, 2018 10:50
Qiita Trend Eliminator
// ==UserScript==
// @name Qiita Trend Eliminator
// @namespace http://tampermonkey.net/
// @version 0.2
// @description https://qiita.com/ を https://qiita.com/tag-feed にいい感じに置き換える
// @author mpyw
// @match https://qiita.com/*
// @grant none
// ==/UserScript==
@mpyw
mpyw / API-official-memo.md
Created July 25, 2016 13:58
Twitterのアンケート関連のAPIのサンプル

アンケートAPIのメモ

全部PHPで書いているので他の言語を使うときは読み替えて下さい。Twitter APIのライブラリはTwistOAuthを使っています。
ここで説明するのは公式のAPIからの取得のみです。作成はここからでは出来ません。出来るのは取得のみです。

ログイン

公式のキーでログインする必要があります。サードパーティではアンケートの情報が一切入らないためです。

// Twitter for Macのキーでログイン
@mpyw
mpyw / git-big-objects.sh
Created April 30, 2017 19:02 — forked from msohn/git-big-objects.sh
Script to show n largest objects in a git repo's pack files.
#!/bin/bash
# -----------------------------------------------------------------------
# Copyright (C) 2013 Matthias Sohn <matthias.sohn@sap.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@mpyw
mpyw / qiita_nonsense_lgtm_button_killer.user.js
Last active March 13, 2020 19:54
qiita_nonsense_lgtm_button_killer.user.js
// ==UserScript==
// @name Qiita Nonsense LGTM Button Killer
// @namespace https://github.com/mpyw
// @version 0.6
// @description Qiita の LGTM を倒す
// @author mpyw
// @match https://qiita.com/*
// @grant none
// ==/UserScript==
@mpyw
mpyw / gist:4f18cff116843eef5634
Last active October 4, 2020 20:39 — forked from cucmberium/gist:e687e88565b6a9ca7039
Twitterの検索API

twitterの検索術 (search/tweetssearch/universal)

search/tweets では一週間以上前のツイートは検索できないので注意

search/universal は公式のConsumerKey/ConsumerSecretでないと使用できない

当方では一切の責任を負いません

@mpyw
mpyw / horagai
Last active January 27, 2021 15:04 — forked from 844196/horagai
去ってください、そして、上手に言語を使用してください; I ngua.Useは言語です、そして、そして、見るために、それは激しく動きます; a.。シェルシェル
ぬあのようにあのようにア紫やおおお
chi枯れしぼむ・.・(小さな声)
MUR大変だった向こう脛ーこんにちは
重い。... これ ... ああ、とてもすでに今日、
それがそのようなキツいんすでも、私は好きでしょう、そして辞職するために既に来るために、なんで。何かがぶっとぅです。-
どのようにする起こるか〜ナ・トグや〜
彼は移動します -- それは迅速です...
ワイシャツすでに…ずぶぬれになります
洗面所のケースは、元気を回復します
2つのケース
@mpyw
mpyw / force_use_latest_tweets.user.js
Last active March 5, 2021 08:06
新 Twitter で「最新のツイート」に強制的に切り替えるやつ
// ==UserScript==
// @name 新 Twitter で「最新のツイート」に強制的に切り替えるやつ
// @namespace https://twitter.com/mpyw
// @version 0.1
// @description お節介機能を殺す
// @author mpyw
// @match https://twitter.com/home
// @grant none
// ==/UserScript==
@mpyw
mpyw / array_splice_assoc.php
Last active January 6, 2022 02:16
array_splice_assoc.php
<?php
// https://stackoverflow.com/questions/16585502/array-splice-preserving-keys/70576992#70576992
function array_splice_assoc(array &$input, int|string $offset, ?int $length = null, $replacement = []): array
{
// Normalize offset
$offset = match (true) {
is_string($offset) => array_flip(array_keys($input))[$offset] ?? throw new OutOfBoundsException(),
$offset < 0 => count($input) + $offset,