This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.18; | |
abstract contract MinimalistErc20 { | |
address public owner; | |
string public name; | |
string public symbol; | |
uint256 public totalSupply; | |
uint8 immutable public decimals; | |
mapping (address => uint256) public balanceOf; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get the total memory in kilobytes | |
TOTAL_MEM_KB=$(grep MemTotal /proc/meminfo | awk '{print $2}') | |
# Calculate half of the total memory | |
HALF_MEM_KB=$((TOTAL_MEM_KB / 2)) | |
# Convert kilobytes to megabytes (MB) | |
HALF_MEM_MB=$((HALF_MEM_KB / 1024)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import dotenv | |
import trio | |
import trio_asyncio | |
from web3 import AsyncWeb3 | |
from web3 import WebsocketProviderV2 | |
dotenv.load_dotenv() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import rebound | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
def add_galactic_potential(sim, mass_distribution): | |
""" | |
Simplified function to simulate the galactic potential effect on the simulation. | |
This function modifies the velocities of particles to simulate a basic galactic potential. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Modified to run both (redudantly, yes, I know, I am paranoid, you should be too) checks | |
# | |
set -eu | |
# find path to liblzma used by sshd | |
path="$(ldd $(which sshd) | grep liblzma | grep -o '/[^ ]*')" | |
echo 'Check one: does it even exist?' | |
# does it even exist? | |
if [ "$path" == "" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.4; | |
interface IERC20 { | |
function approve(address spender, uint256 amount) external returns (bool); | |
} | |
interface IERC3156FlashBorrower { | |
function onFlashLoan( | |
address initiator, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SPDX-License-Identifier: Unlicense | |
pragma solidity ^0.8.0; | |
pragma abicoder v2; | |
import "@uniswap/v2-periphery/contracts/interfaces/IWETH.sol"; | |
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol"; | |
import "@uniswap/v3-core/contracts/libraries/LowGasSafeMath.sol"; | |
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; | |
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol"; | |
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract TestStateChange { | |
uint public originalValue = 123; | |
uint public oldValue; | |
uint public incrementer = 0; | |
bytes4 public constant CHANGE_SEL = bytes4(keccak256(bytes('changeState(uint256)'))); | |
bytes4 public constant WRAP_CHANGE_SEL = bytes4(keccak256(bytes('wrapChangeState(uint256)'))); | |
error CallFailedError(string reason,address msgSender,address txOrigin); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
// 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2 | |
contract TestExec { | |
address owner; | |
constructor() { | |
owner = msg.sender; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import json | |
import aiohttp | |
class AsyncHttpClient: | |
def __init__(self, _headers=None, base_url: str = None, timeout: (int, float) = 60): | |
""" | |
A skeletal asynchronous HTTP class. Because I found myself writing this same code |
NewerOlder