Skip to content

Instantly share code, notes, and snippets.

Avatar

Jackson Palmer ummjackson

View GitHub Profile
@ummjackson
ummjackson / timeline.json
Created Jan 18, 2023
why is this breaking some mastodon clients?
View timeline.json
[{
"id": "1615562828584480769",
"created_at": "2023-01-18T04:12:48.000Z",
"in_reply_to_id": 1615554007954587600,
"in_reply_to_account_id": 75586944,
"sensitive": false,
"spoiler_text": "",
"visibility": "public",
"language": "en",
"uri": "https://twitter.com/karl_delo/status/1615562828584480769",
@ummjackson
ummjackson / fedistream.html
Last active Jan 24, 2023
fedistream - filter the Mastodon firehose with a single HTML file (work in progress!). Instructions: download the .zip, extract it and double-click the "fedistream.html" file to get started.
View fedistream.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>fedistream</title>
<style>
html,
body {
font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir,
@ummjackson
ummjackson / mastodon-emojified-content.js
Created Jan 8, 2023
JavaScript function to convert Mastodon custom emoji shortcodes into HTML image tags
View mastodon-emojified-content.js
/*
This JavaScript function takes "content" value and "emojis" array from a Mastodon API "status" object and converts custom emoji shortcodes into the corresponding HTML image tags.
Example usage, assuming you have just parsed a JSON "status" object from the Mastodon API into a "status" variable:
emojifiedContent = customEmojis(status.content, status.emojis);
You will then want to use CSS to style the ".emoji" class. Example CSS:
.emoji {
@ummjackson
ummjackson / MASTO-FTS.MD
Last active Jan 4, 2023
Run full-text search SQL on a Mastodon federated stream
View MASTO-FTS.MD

Mastodon Streaming Full-Text Search

This is a (hacky) implementation of full-text search in Python for Mastodon. Built and tested with Python 3.10

Errors and disconnections are not handled, so you'll need to implement that for something more robust and production ready. If you just want to monitor certain keywords via SQL queries from a real-time stream, however, the simple implementation may suit your needs.

You can change the instance URL on Line 28 (default: mastodon.social) to fetch the federated timeline from somehwere else, if you'd like. Big, well-federated instances will obviously expose the most rich streams.

Running

@ummjackson
ummjackson / audio-spectrum.sh
Created Jul 13, 2022
FFmpeg Audio Spectrum
View audio-spectrum.sh
#!/bin/sh
# Make sure you have ffmpeg installed (eg. brew install ffmpeg)
ffmpeg -i "your-audio-file.wav" -filter_complex "asplit[main][tmp]; [tmp]aformat=channel_layouts=mono,aresample=32000 [cut]; [cut]showfreqs=mode=bar:ascale=sqrt:win_size=2048:s=1920x240:colors=White[out]; [out]split[top][bottom]; [bottom]vflip[bottom]; [top][bottom]vstack=inputs=2[combined]" -map "[combined]" -pix_fmt yuv420p -map "[main]" -preset ultrafast output.mp4
@ummjackson
ummjackson / xrpaway.py
Last active Nov 24, 2022
XRP Away™️ - automatically block XRP fanatics sliding into your Twitter mentions
View xrpaway.py
# Requirement: pip install tweepy
import tweepy
# Credentials go here (generate at: https://apps.twitter.com)
auth = tweepy.OAuthHandler('consumer_key', 'consumer_secret')
auth.set_access_token('access_token', 'access_token_secret')
# Connect to Twitter
api = tweepy.API(auth)
View awdy-bitcoin.py
import time
import pandas as pd
from selenium import webdriver
# These are the variables which must be calculated by the script.
consensus_distribution = None
wealth_distribution = None
client_codebases = None
public_nodes_source = None
View killabot.py
# Requirements: pip install tweepy fuzzywuzzy python-Levenshtein
import tweepy
import re
from fuzzywuzzy import fuzz
# Credentials go here (generate at: https://apps.twitter.com)
auth = tweepy.OAuthHandler('consumer_key', 'consumer_secret')
auth.set_access_token('access_token', 'access_token_secret')
# Connect to Twitter
@ummjackson
ummjackson / chime-backup.md
Created Apr 7, 2017
chime.social data backup, prior to closure of instance.
View chime-backup.md

🔔 chime.social backup

this is a backup of tables containing non-private/sensitive data from chime.social, prior to the closure of the instance.

@ummjackson
ummjackson / social-requirements.md
Created Nov 8, 2016
Brainstorming about what Twitter could be... 🤔
View social-requirements.md

This is a WIP

Basics

  • Implement core feature set of Twitter (users, statuses, followers/friends, lists, blocking)
  • Do not implement direct messaging initially (there are already any IM clients out there)
  • Implement 1:1 replica of Twitter v1.1 API
    • Very generous limits up-front (only what's needed to avoid denial of service / spam attacks)
    • Clients must register a Client ID prior to making requests (same as Twitter)