Mastodon の API を叩くには以下の手順を踏む必要がある:
- OAuth2 クライアントを登録する
- アクセストークンを取得する
- アクセストークンを
Authorization
ヘッダに指定して API にアクセスする
Mastodon の Apps API に登録情報を送ってクライアントを払い出してもらう(一度だけやれば OK).
import os | |
import requests | |
import time | |
from pprint import pprint | |
def poll_job(s, redash_url, job): | |
# TODO: add timeout | |
while job['status'] not in (3,4): | |
response = s.get('{}/api/jobs/{}'.format(redash_url, job['id'])) |
import jinja2 | |
from flask import Flask, render_template, request, redirect, url_for | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from . import formatting | |
from .config import get_config | |
db = SQLAlchemy() |
""" | |
Author: Jonathan Cardasis | |
""" | |
import socket | |
import signal # Allow socket destruction on Ctrl+C | |
import sys | |
import time | |
import threading |
import {Observable, Subject} from 'rxjs' | |
// # 材料 | |
// ## ご飯 | |
class ご飯 { | |
freeze() { | |
this.温度 = -10 | |
return this | |
} |
import asyncio | |
from aiohttp import web | |
import subprocess | |
async def uptime_handler(request): | |
# http://HOST:PORT/?interval=90 | |
interval = int(request.GET.get('interval', 1)) | |
# Without the Content-Type, most (all?) browsers will not render |
#!/bin/bash | |
# Slack notification script for Munin | |
# Mark Matienzo (@anarchivist) | |
# | |
# To use: | |
# 1) Create a new incoming webhook for Slack | |
# 2) Edit the configuration variables that start with "SLACK_" below | |
# 3) Add the following to your munin configuration: | |
# |
package main | |
import ( | |
"fmt" | |
"os" | |
"github.com/codegangsta/cli" | |
) | |
func main() { |
#!/bin/sh | |
root=`dirname $0`/.. | |
secret_dir=$root/.secret | |
suffix='.enc' | |
for target in $(find $secret_dir -name "*$suffix" ! -name ".*" -type f); do | |
file=$(echo $target | sed -e "s/.enc$//") | |
if [ -e $file ]; then | |
echo "Skip $file" | |
continue |
2017-05-09
@voluntas
3.14
MQTT をググって調べた人向け