Skip to content

Instantly share code, notes, and snippets.

View scottyeager's full-sized avatar

Scott Yeager scottyeager

View GitHub Profile
#!/bin/bash
# This script is meant to be run in a fresh Ubuntu VM. It demonstrates how to
# assign Mycelium addresses to Docker containers, from a single Mycelium
# instance running on the host. When the script completes, there will be a
# container running with a Mycelium address assigned to it.
# Install prerequisites
apt update && apt install -y wget iproute2
@scottyeager
scottyeager / docker2flist.sh
Created September 10, 2024 22:43
Converts a Dockerfile in the pwd into a ThreeFold flist on hub.grid.tf
#!/bin/bash
tag=$1
docker_user=$(docker system info | grep 'Username' | cut -d ' ' -f 3)
full_tag=${docker_user}/${tag}
if [ -f ~/.config/tfhub ]; then
tfhub_token=$(cat ~/.config/tfhub)
else
read -p "Please enter your tfhub token: " tfhub_token
@scottyeager
scottyeager / kill-anchors.js
Created February 14, 2024 05:54
Some JS to strip anchor elements of their class
// Watch the whole document.
const targetNode = document.documentElement;
// Not really sure if we're looking for childList or subtree
const config = { attributes: true, childList: true, subtree: true };
// It's brute force, but it works. After we do this, all the links actually work
// like links, instead of just causing mutations
const kill_anchors = () => {
var anchors = document.querySelectorAll("a")
@scottyeager
scottyeager / farmerbot-setup.sh
Last active May 8, 2025 01:27
Farmerbot Setup Script
#!/bin/bash
readonly latest_version="v0.16.8"
# Ask a yes/no question and return an appropriate exit status
yes_no () {
read -p "$* (y/n): " answer
if [[ $answer == [yY] || $answer == [yY][eE][sS] ]]; then
return 0
else
@scottyeager
scottyeager / get-ygg-peers.py
Created December 23, 2022 23:46
Python script to fetch the peers of all peers of an Yggdrasil node
# It's a script that prints some stats about the Yggdrasil peers that your local machine is connected to, based partiall on the crawler script from https://github.com/Arceliar/yggdrasil-map. Tells how many peers each of your peers is connected to, how many unique peers there are total, and how many interconnections there are between the peers you've queried.
import json, socket, sys, time
socktype = socket.AF_UNIX
sockaddr = "/var/run/yggdrasil.sock"
def getNodeInfoRequest(key):
return '{{"keepalive":true, "request":"getNodeInfo", "arguments": {{"key":"{}"}}}}'.format(key)