Skip to content

Instantly share code, notes, and snippets.

@btc100k
btc100k / setup_l2tp_vpn.sh
Created December 24, 2024 16:44
Here is how to establish a VPN connection from ubuntu/mint (client) to Ubiquiti UDM (server).
#!/bin/bash
# Much of this script came from:
# https://gist.github.com/danielv99/ae6dbd6d3f5b8fe4241519f5a0733ff3
# but a few hours of trial/error/debugging/chatgpt/grok went into the few changes required to get VPN working with my UDM
# YMMV
# My debugging went as followed:
# In one window, create this script, chmod +x it
# In another window, run `journalctl -u xl2tpd -f` to look for errors.
# if this doesn't just plain work for you,
@btc100k
btc100k / setup_l2tp_vpn.sh
Created December 24, 2024 16:41
Here is how to establish a VPN connection from ubuntu/mint (client) to Ubiquiti UDM (server).
#!/bin/bash
apt-get -y update && apt-get -y upgrade
apt-get -y install strongswan xl2tpd libstrongswan-standard-plugins libstrongswan-extra-plugins
service strongswan-starter stop
service xl2tpd stop
ipsec stop
VPN_SERVER_IP='<server ip>'
import requests
from bs4 import BeautifulSoup
import sys
# This python script scrapes Ocean.xyz and creates a csv of the payouts to a given BTC address.
#
# it parses out:
# - 24h hash rate average
# - accepted 24h shares
# - stimated earnings/day
@btc100k
btc100k / ocean_24hours.py
Created March 4, 2024 04:44
Parse out 24 hours hash rate & shares from Ocean.xyz
from bs4 import BeautifulSoup
...
# Use Beautiful Soup to parse the HTML
soup = BeautifulSoup(html_content, 'html.parser')
# Find the table body
table_body = soup.find('tbody', id='hashrates-tablerows')
import requests
import datetime
from bs4 import BeautifulSoup
import sys
# This python script scrapes Ocean.xyz and creates a csv of the payouts to a given BTC address.
#
# This will be useful for anyone mining on Ocean.xyz who wants to keep track of their earnings in BTC or USD
#
# Example output:
@btc100k
btc100k / sat_history.py
Last active December 18, 2023 20:06
Starting with a given UTXO, research backward through the BTC blockchain to find what pools solved the block it was in and its ancestors.
import time
import datetime
import requests
import copy
MEMPOOL_HOST = "umbrel.local:3006"
MEMPOOL_PROTOCOL = "http"
DEBUGGING = False
SLEEP_BETWEEN_LEVELS = 0
SLEEP_BETWEEN_BUCKETS = 1
@btc100k
btc100k / check_lstime.py
Last active September 18, 2021 01:20
Here is some python code that shows how you'd pull the S19's info and search for the LSTime. If the last share time is too large, you might want to restart the machine.
import requests
from requests.auth import HTTPDigestAuth
TEN_MINUTES_IN_SECONDS = 60 * 10
HIGH_LSTIME_IN_SECONDS = 120
session = requests.Session()
class S19Miner:
@btc100k
btc100k / coinbasePro.py
Last active January 28, 2021 12:00
Automatically enter orders on Coinbase Pro
# Use this python script to create orders at percentage-intervals below the current market price of BTCUSD
# The percentage dips you'd like to purchase can be specified in the variable PERCENTAGE_DIPS
# by default, the values represent 1.5%, 2.5%, 4%, 5%, 7%, 8.5%, 10%, 12.5% below the current spot price.
# You can add/subtract values from the PERCENTAGE_DIPS array
# and your available balance will be split evenly amongst those percentages
#
# Tips are welcomed. Please send a few satoshi to:
#
# bc1qzknc4p68hdffxkk3n6wd27uh09ys9flxrudrjw
#