Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
✊✊🏼✊🏽✊🏾

Stefan Bohacek stefanbohacek

💭
✊✊🏼✊🏽✊🏾
View GitHub Profile
@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.
View gist:4dde5b0231e504a4ae29e234306b8602
<!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"
View random-image-tweet-attribution.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')),
images = require(path.join(__dirname, 'images.js'));
View random-image-tweet.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'));
View twittercard.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.
View twitter-poll.py
# 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()
View getweatherforlocation.php
<?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(
View getlocationandweather.php
<?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;
View keybase.md

Keybase proof

I hereby claim:

  • I am fourtonfish on github.
  • I am fourtonfish (https://keybase.io/fourtonfish) on keybase.
  • I have a public key whose fingerprint is 08E6 1F26 D587 2E83 D671 215C D02B E80F 2CA4 FC74

To claim this, I am signing this object: