Skip to content

Instantly share code, notes, and snippets.

View stefanbohacek's full-sized avatar
💭
✊✊🏼✊🏽✊🏾

Stefan Bohacek stefanbohacek

💭
✊✊🏼✊🏽✊🏾
View GitHub Profile
@stefanbohacek
stefanbohacek / fediverse-hide-media.md
Last active April 13, 2024 17:20
Hiding media attachments on fediverse servers

Mastodon

Solution 1: make media upload directories write-only

chmod 722 /home/mastodon/live/public/system/cache
chmod 722 /home/mastodon/live/public/system/media_attachments

# reset permissions
chmod 777 /home/mastodon/live/public/system/cache
(async () => {
const domain = "...";
const token = "...";
const postUrl = "...";
let response;
response = await fetch(
`https://${domain}/authorize_interaction?uri=${postUrl}`,
{
headers: {
@stefanbohacek
stefanbohacek / gist:4dde5b0231e504a4ae29e234306b8602
Created August 1, 2023 00:22
Source code for the "Preview domain blocks before moving to a new Mastodon instance" blog post.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65"
/*
A simple Twitter bot that posts random images.
Tutorial: https://botwiki.org/resource/tutorial/random-image-tweet/
*/
const fs = require('fs'),
path = require('path'),
Twit = require('twit'),
config = require(path.join(__dirname, 'config.js')),
images = require(path.join(__dirname, 'images.js'));
/*
A simple Twitter bot that posts random images.
Tutorial: https://botwiki.org/resource/tutorial/random-image-tweet/
*/
const fs = require('fs'),
path = require('path'),
Twit = require('twit'),
config = require(path.join(__dirname, 'config.js'));
/*
A copy of https://gist.github.com/airhadoken/8742d16a2a190a3505a2
See also: https://botwiki.org/bots/twitterbots/emoji__polls/
*/
var T = require("twit");
var Q = require("Q");
// key and secret for Twitter for iPhone.
// A whitelisted app is needed to access the cards API; you can't just create your own currently.
# Original: https://paste.wuffs.org/raw/160201.220633.4garttu6
from twitter import *
import json
import sys
import mysql.connector
import random
conn = mysql.connector.connect(user='wikistuff', password='ffutsikiw', unix_socket='/var/run/mysqld/mysqld.sock', database='wikistuff')
c = conn.cursor()
<?php
if (isset($_REQUEST["owapikey"]) && isset($_REQUEST["units"]) && isset($_REQUEST["location"])){
$owapikey = $_REQUEST['owapikey'];
$units = $_REQUEST['units'];
$location = $_REQUEST['location'];
$request = json_decode(file_get_contents("http://api.openweathermap.org/data/2.5/weather?q={$location}&units={$units}&APPID={$owapikey}"));
$weather = array(
<?php
if (isset($_REQUEST["owapikey"]) && isset($_REQUEST["units"])){
$ip = $_SERVER['REMOTE_ADDR'];
$owapikey = $_REQUEST['owapikey'];
$units = $_REQUEST['units'];
// $request = json_decode(file_get_contents("http://smart-ip.net/geoip-json/{$ip}"));
$latitude = $request->latitude;