Skip to content

Instantly share code, notes, and snippets.

@YuzuRyo61
YuzuRyo61 / .htaccess
Last active February 15, 2017 08:32
URLディレクトリ解析。解析後はArrayとして返される
#(Apache用)どのURLにアクセスしても、main.phpにアクセスできるようにする
Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /main.php [L]
</IfModule>
@YuzuRyo61
YuzuRyo61 / Add
Last active July 27, 2017 11:11
Apache経由でMattermostを使いたいとき ref: http://qiita.com/YuzuRyo61/items/d5c9f04f4587b753d53a
Header add Upgrade "Websocket"
Header add Connection "Upgrade"
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / "ws://localhost:8065/"
ProxyPassReverse / "ws://localhost:8065/"
@YuzuRyo61
YuzuRyo61 / file0.txt
Last active October 13, 2017 02:54
sftpのみ使用するユーザーで鍵認証を使用する ref: http://qiita.com/YuzuRyo61/items/c57d9830c29709b6660b
Match group sftponly
ChrootDirectory /home/%u
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
@YuzuRyo61
YuzuRyo61 / toot.sh
Created January 21, 2018 11:30
curlでmastodonの投稿APIを叩くだけのスクリプト。整備がとても荒いと思います。ですがふつーに使うのであれば問題ない・・・と思う。
#!/bin/bash
# Setting
ACCESS_TOKEN="CHANGE_HERE"
INSTANCE_ADDRESS="CHANGE_HERE"
# === There are system scripts. if you are not familiar the bash script, Please do not edit their scripts. ===
SETINC=0
if [ $ACCESS_TOKEN = "CHANGE_HERE" ]; then
@YuzuRyo61
YuzuRyo61 / STANDALONE.py
Last active September 30, 2018 12:59
端末で見れるMastodonStreaming
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
初回セットアップスクリプトを追加したスクリプトです。これ一つでタイムラインをリアルタイムで見ることができるようになります。
"""
"""
Code by YuzuRyo61.
mastodon.timeline.read.py の改良型。差分がそこそこあるので新しく貼り直し。
CWの表記追加と、引数で使用するStreamを選択することができるようにしました。
ちなみに、Streamの選択優先度は"home > local > public"の順になってます。
@YuzuRyo61
YuzuRyo61 / unfinished.toot.py
Created February 11, 2018 05:27
動作しないPythonのトゥートスクリプト。中途半端すぎるので動きません。助けて。
import os,sys, traceback, warnings, re
from mastodon import Mastodon
class Toot():
def __init__(self):
with open("instance.txt") as a:
self.address = a.readlines()
toot = ""
self.tootl = ""
@YuzuRyo61
YuzuRyo61 / mstdnoauth.py
Last active February 23, 2018 13:03
Mastodon.pyにはOAuth機能が搭載されていないので自作。一部拝借したところもあり。
"""
もしかしたらいらないライブラリがあるかもしれません。その場合は適宜外してもらっても構いません。
参考文献:
- https://qiita.com/civic/items/7358dc1c54ff8e71c326
- https://github.com/civic/mastodon-auth-example/blob/master/mastodon_auth_example.py
"""
from urllib.parse import urlencode
import requests,json,os,re
class mstdnoauth:
@YuzuRyo61
YuzuRyo61 / Mastlog.py
Last active May 4, 2018 14:24
またつまらぬものを作ってしまった。ただの男ロマンスクリプトです^^;
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
import webbrowser
import requests
import re
import json
@YuzuRyo61
YuzuRyo61 / open.js
Last active May 21, 2018 07:04
マストドンインスタンスのシェアダイアログを表示する超簡易プログラム。ブックマークレット型になってるので、ブラウザでrawでそのままブックマークに登録してください( ˘ω˘)
javascript:var instance = window.prompt('インスタンスアドレスを入力してください。プロトコルは入れないでください(https://など)。');if(instance!=null){window.open('https://'+instance+'/share', 'mstjsshare', 'width=450, height=500, menubar=no, toolbar=no, scrollbars=no');}
@YuzuRyo61
YuzuRyo61 / LICENSE
Created November 14, 2018 09:29
MisskeyでApiトークンを作成するためのPythonスクリプト。対話式なので簡単に作成できます。pyperclipライブラリを導入しているとクリップボードにもコピーできます。
Copyright 2018 YuzuRyo61
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 SOFTWARE OR THE USE OR OTHER D