Skip to content

Instantly share code, notes, and snippets.

@Geczy
Geczy / migrate.sh
Last active November 24, 2024 06:13
Migrate Coolify to a new server
#!/bin/bash
# This script will backup your Coolify instance and move everything to a new server. Docker volumes, Coolify database, and ssh keys
# 1. Script must run on the source server
# 2. Have all the containers running that you want to migrate
# Configuration - Modify as needed
sshKeyPath="$HOME/.ssh/your_private_key" # Key to destination server
destinationHost="server.example.com"
@franciscomvargas
franciscomvargas / json_comquotes.md
Last active October 15, 2023 18:56
JSON Quote Remover

JSON Quote Remover

Description

This Python function, json_comquotes, is a handy tool for preprocessing JSON data that contains unescaped quotes within string values. It takes a JSON string as input and transforms it by replacing the double and single quotes within the string values with alternative characters, allowing you to parse the JSON data without errors.

CLI Capability

Take a look into json_esquotes

Key Features:

  • Replaces double quotes " within string values with escaped double quotes \".
@ffeldhaus
ffeldhaus / pre_request.js
Last active July 14, 2024 00:22 — forked from dinvlad/pre_request.js
Auto-generate Google Access and ID tokens from a Service Account key and save it in Postman
/* This script auto-generates a Google OAuth token from a Service Account key,
* and stores that token in accessToken variable in Postman.
*
* Prior to invoking it, please paste the contents of the key JSON
* into serviceAccountKey variable in a Postman environment.
*
* Then, paste the script into the "Pre-request Script" section
* of a Postman request or collection.
*
* The script will cache and reuse the token until it's within
@yorickdowne
yorickdowne / HallOfBlame.md
Last active November 15, 2024 23:14
Great and less great SSDs for Ethereum nodes

Overview

Syncing an Ethereum node is largely reliant on latency and IOPS, I/O Per Second, of the storage. Budget SSDs will struggle to an extent, and some won't be able to sync at all. For simplicity, this page treats IOPS as a proxy for/predictor of latency.

This document aims to snapshot some known good and known bad models.

The drive lists are ordered by interface and then by capacity and alphabetically by vendor name, not by preference. The lists are not exhaustive at all. @mwpastore linked a filterable spreadsheet in comments that has a far greater variety of drives and their characteristics. Filter it by DRAM yes, NAND Type TLC, Form Factor M.2, and desired capacity.

For size, 4TB comes recommended as of mid 2024. The smaller 2TB drive should last an Ethereum full node until early 2025 or thereabouts, with crystal ball uncertainty. The Portal team aim to make 2TB [last forever with EIP-4444](https://

@nosilver4u
nosilver4u / ewwwio-adjust-sharpening.php
Last active March 23, 2023 23:48
EWWW IO adjust Sharpening functions/params.
<?php
/*
Plugin Name: EWWW IO Adjust Sharpening
Version: 1.0.0
*/
/*
* Valid options:
* 'FILTER_POINT',
* 'FILTER_BOX',
@yorickdowne
yorickdowne / GethBEHAVE.md
Last active July 22, 2024 16:26
Pruning Geth 1.10.x, 1.11.x, 1.12.x

Note: PBSS in Geth >=1.13.0 removes the need to prune manually.


Old content for reference

Overview

Geth (Go-Ethereum) as of July 2022 takes about 650 GiB of space on a fast/snap sync, and then grows by ~ 14 GiB/week with default cache, ~ 8 GiB/week with more cache.

@tschubotz
tschubotz / test_data.py
Last active March 5, 2024 05:01
Script to submit a number of Multisend transactions to a Gnosis Safe via the REST API
import argparse
import json
from random import randrange
from typing import List, Optional, Sequence
from urllib.parse import urljoin
import requests
from eth_account import Account
from eth_account.signers.local import LocalAccount
from hexbytes import HexBytes
@lorey
lorey / selenium_xhr_requests_via_performance_logging.py
Last active November 5, 2024 15:20
Access Chrome's network tab (e.g. XHR requests) with Selenium
#
# This small example shows you how to access JS-based requests via Selenium
# Like this, one can access raw data for scraping,
# for example on many JS-intensive/React-based websites
#
from time import sleep
from selenium import webdriver
from selenium.webdriver import DesiredCapabilities
@foliovision
foliovision / wp_is_mobile-wp-rocket.php
Created February 20, 2020 14:07
Make wp_is_mobile() use WP Rocket mobile detection
<?php
/*
Core WordPress function wp_is_mobile() detects iPad as mobile, so we filter it and use WP Rocket mobile detection
*/
add_filter( 'wp_is_mobile', 'fv_bra_wp_is_mobile' );
function fv_bra_wp_is_mobile( $is_mobile ) {
if ( class_exists( 'Rocket_Mobile_Detect' ) ) {
$detect = new Rocket_Mobile_Detect();
@wpcarro
wpcarro / retry_loop.py
Created October 29, 2019 17:37
Simple retry loop in python with error simulation.
import random
def danger():
if random.choice([True, False]):
raise Exception
def main():
"""Attempt to loop `loop_count` times. Simulate random errors and create a