Mastodon の API を叩くには以下の手順を踏む必要がある:
- OAuth2 クライアントを登録する
- アクセストークンを取得する
- アクセストークンを
Authorization
ヘッダに指定して API にアクセスする
Mastodon の Apps API に登録情報を送ってクライアントを払い出してもらう(一度だけやれば OK).
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf | |
// Remove any duplicates from an array of primitives. | |
const unique = [...new Set(arr)] | |
// Sleep in async functions. Use: await sleep(2000). | |
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms))); | |
// or | |
const sleep = util.promisify(setTimeout); |
# -*- coding: utf-8 -*- | |
from urllib.parse import urlunsplit | |
import requests | |
from oauthlib.oauth2 import LegacyApplicationClient | |
from requests_oauthlib import OAuth2Session | |
def register_app(client_name, host, redirect_uris='urn:ietf:wg:oauth:2.0:oob', | |
scopes='read write follow'): |
BEGIN { | |
print "# CHANGELOG" | |
COMMIT = "" | |
OTHER_COMMIT_FIRST=1 | |
DATE = "" | |
TAG = "" | |
"git config --get remote.origin.url" | getline ORIGIN | |
} | |
/^commit/ { |
The MIT License (MIT)
Copyright © 2021 Matt Lewis
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT
@azrsjp です。これは,DTM Advent Calendar 2015の19日目の記事です。
本記事はDTM究極初心者が「こういうことをしたらとりあえず前よりは聞ける曲が完成させられるレベルになれた」という思い出話を綴ります。あくまで思い出話です。思い出話。今現在DTMに興味があるけど,何をしたらいいかわからない,__センスがないのでは…__と悩んでる方に,センスがなくても,まぁ形にはなるということを示し,希望を持って頂くために書きます。
この記事を読んで幸せになる人物像は以下のような方(昔の僕)
# -*- coding: utf-8 -*- | |
"""Demonstrate high quality docstrings. | |
Module-level docstrings appear as the first "statement" in a module. Remember, | |
that while strings are regular Python statements, comments are not, so an | |
inline comment may precede the module-level docstring. | |
After importing a module, you can access this special string object through the | |
``__doc__`` attribute; yes, it's actually available as a runtime attribute, | |
despite not being given an explicit name! The ``__doc__`` attribute is also |
#!/bin/sh | |
#coding: utf-8 | |
GET="wget --no-check-certificate" | |
# move homedir | |
cd ~ | |
# clone | |
mkdir .vim |
従来の CVCS (集中バージョン管理システム)のリビジョン番号は連番。 SVN はサーバーにデプロイした時点でリビジョン番号1と設定される。