Skip to content

Instantly share code, notes, and snippets.

View bazbt3's full-sized avatar

bazbt3 bazbt3

View GitHub Profile
@aparrish
aparrish / index.md
Last active May 6, 2023 14:29
Getting credentials for the Mastodon API with Mastodon.py. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/

Getting credentials for the Mastodon API with Mastodon.py, step by step

Making a bot? Making a bot in Python? Making a bot in Python that uses the Mastodon API? If so, chances are you need to get some credentials. Here's how I did it!

(The following tutorial uses Python 2.7, but if you're using Python 3+ everything should work substantially the same.)

Mastodon.py authentication

I just started using it, but it looks like Mastodon.py is a pretty great library for working with the Mastodon API! However, all of the authentication examples use static files to store credentials, which I don't like—I'm afraid I'll accidentally push them to Github. I like to keep my authentication as close to the actual command that runs the program as possible, so usually I pass them on the command line to the script running my bot. To do this, I need to get the appropriate credentials on their own, as separate strings that I can cut and paste.

@bazbt3
bazbt3 / ADN_Wiki_refining.md
Last active January 26, 2016 06:32
Refining the App.net Wiki: Ideas

Triaging:

What, why:

There are a lot of effectively obsolete pages at the App.net Wiki - http://appdotnetwiki.net/ - some in need of explicit instructions for new viewers, others requiring edits to bring them up-to-date.

How:

I'm never ever in favour of deletions, hate broken links; we should simply work around them. But that's only my opinion.

@bazbt3
bazbt3 / Adventure-map.pdf
Last active February 27, 2016 20:19
Adventure
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bazbt3
bazbt3 / refresh_Tmux_windows_2
Created November 8, 2014 16:11
I want to refresh all windows & panes in a Tmux session. Stumped. (Followup.)
In essence I want a shell script menu option to refresh Tmux windows & panes.
(There is no user tmux.conf file - I use Tmuxinator to setup Tmux {it's easier} - thus it's not going to be as easy as this Linux noob thinks!)
I have 3 files (none yet in a public repo):
1. ~/Documents/ayadn_run.sh - calls up a Tmuxinator file,
2. ~/.tmuxinator/ayadn.yml - which starts a Tmux session and in turn calls up
3. ~/Documents/ayadn_shell.sh - the shell script menu running inside the Tmux session.
ayadn_shell.sh:
@bazbt3
bazbt3 / refresh_Tmux_windows
Created November 6, 2014 12:54
I want to refresh all windows & panes in a Tmux session. Stumped.
# ~/Documents/ayadn_shell.sh
#
# I want to refresh all windows & panes running in the currently-running Tmux session.
# I'm not Linux- or Tmux- literate (2 weeks in.)
#
# Menu option (item 8, not implemented) in the partial code below doesn't work.
# I intended this code to close Tmux and then re-open it - mirroring the manual method I use currently.
#
# "Tmux kill-session" exits to the command line
# "mux ayadn" starts Tmuxinator and sets up a Tmux session using ~/.tmuxinator/ayadn.yml