Skip to content

Instantly share code, notes, and snippets.

View johnnieskywalker's full-sized avatar
⛓️
Exploring Blockchain

Johnnie Lucas johnnieskywalker

⛓️
Exploring Blockchain
View GitHub Profile
@johnnieskywalker
johnnieskywalker / Onx_withdraw.md
Last active June 19, 2024 09:11
How to withdraw funds from OnX guide

Instructions for Withdrawing Funds from OnX

If your funds are stuck in OnX, follow these steps to withdraw them from the smart contracts.

Identifying Where Your Funds Are Stuck

Your funds could be in one of several smart contracts. Most likely, they are in the OnX Farm:

@johnnieskywalker
johnnieskywalker / Example.log
Last active April 12, 2024 15:47
Elvish Translator
python3 openai-test.py
Enter the language to translate from: polski
Enter the text to translate: Gandalfie którędy do najbliższej gospody ?
The sentence "Gandalfie którędy do najbliższej gospody?" translates to Elvish as "Mithrandir, man cerir tenest i orthad?" in the language of the Elves from The Lord of the Rings.
@johnnieskywalker
johnnieskywalker / index.js
Last active March 27, 2024 18:00
Merkle with proofs
class MerkleTree {
constructor(leaves, concat) {
this.leaves = leaves;
this.concat = concat;
this.tree = [];
this.buildTree();
}
buildTree() {
let currentLevel = this.leaves;
class TXO {
constructor(owner, amount) {
this.owner = owner;
this.amount = amount;
this.spent = false;
}
spend() {
this.spent = true;
}
}
{
liquidityPosition(id: "0x795065dcc9f64b5614c407a6efdc400da6221fb0-0x0000000000007f150bd6f54c40a34d7c3d5e9f56") {
pair {
id
token0 {
id
symbol
}
token1 {
id
{
swaps(orderBy: timestamp, orderDirection: desc, where: { pair: "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852" }, first: 1) {
id
timestamp
pair {
token0 {
symbol
id
}
token1 {
@johnnieskywalker
johnnieskywalker / backup_valheim.sh
Last active August 29, 2023 21:44
Valheim auto backup in github script
#!/bin/bash
# Define the source and destination directories
VALHEIM_HOME=""
VALHEIM_BACKUP=~/BACKUPS/Valheim
# Check if VALHEIM_HOME exists
if [ ! -d "$VALHEIM_HOME" ]; then
echo "Error: VALHEIM_HOME directory does not exist."
exit 1
@johnnieskywalker
johnnieskywalker / k6init.js
Created August 21, 2023 16:11
k6init.js, to run `node k6init.js `
const fs = require('fs');
const path = require('path');
const directories = [
'tests',
'modules',
'data'
];
console.log(`Initializing new K6 project structure in the current directory.`);
@johnnieskywalker
johnnieskywalker / my-echidna.dockerfile
Last active May 19, 2023 12:27
Dockerfile to run echidna with various solc versions
FROM ghcr.io/crytic/echidna/echidna:testing-master
RUN apt-get update && apt-get install -y curl
RUN ln -s /usr/local/solc-select/scripts/solc-select /usr/bin
# Install any solc version is needed for contracts
RUN solc-select install 0.8.0
RUN solc-select install 0.8.1
ENV PATH="/root/.solc-select:$PATH"
RUN solc-select use 0.8.1
@johnnieskywalker
johnnieskywalker / clean_flat_files.py
Created May 11, 2023 10:39
Script for sleaning spdx from flat .sol files, except the first one
import os
flattened_dir = "./flattened"
for filename in os.listdir(flattened_dir):
file_path = os.path.join(flattened_dir, filename)
if os.path.isfile(file_path) and filename.endswith("_flattened.sol"):
with open(file_path, "r") as f:
lines = f.readlines()