Skip to content

Instantly share code, notes, and snippets.

@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 \".
@yorickdowne
yorickdowne / HallOfBlame.md
Last active May 1, 2024 12:11
Great and less great SSDs for Ethereum nodes

Overview

Syncing an Ethereum node is largely reliant on IOPS, I/O Per Second. Budget SSDs will struggle to an extent, and some won't be able to sync at all.

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

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.

High-level, QLC and DRAMless are far slower than "mainstream" SSDs. QLC has lower endurance as well. Any savings will be gone when the drive fails early and needs to be replaced.

@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 March 13, 2024 01:10
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 April 14, 2024 09:11
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
@dvf
dvf / change-codec.md
Last active May 1, 2024 19:52
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

@cobaltapps
cobaltapps / genesis-page-builder-page-styles.css
Last active June 9, 2022 07:35
Styles for Genesis Theme pages when using a Page Builder Plugin.
.builder-page .site-inner {
max-width: 100%;
padding: 0;
}
.builder-page .content {
width: 100%;
}
.builder-page .entry {
margin-bottom: 0;
}