Skip to content

Instantly share code, notes, and snippets.

View mikeshultz's full-sized avatar

Mike Shultz mikeshultz

View GitHub Profile
@mikeshultz
mikeshultz / printing.vy
Created February 9, 2024 19:41
Vyper console print test
# pragma version ^0.3.0
@view
@external
def printcall_uint(x: uint256) -> uint256:
print(x)
return x
@mikeshultz
mikeshultz / dark.sh
Created November 29, 2023 03:14
Darkman scripts to toggle light/dark mode
#!/bin/env bash
# Switch kitty to dark mode
$HOME/.local/bin/kitty_mode dark
# Switch Sublime
$HOME/.local/bin/sublime_mode dark
gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark"
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
@mikeshultz
mikeshultz / backup_encrypted
Created September 19, 2023 19:11
Script to create encrypted tarball backups
#!/bin/env bash
###############################################################
# Script to create a symmetric encrypted backup tarball
#
# Usage
# -----
# backup_encrypted test /run/media/mike/asdf1234 ~/.backups/
#
# Extracting backup
# -----------------
@mikeshultz
mikeshultz / main.rs
Created October 10, 2022 05:43
Program for LED rotation on STM32DICOVERY
#![no_std]
#![no_main]
// Rotate LEDs on board and allow user to change their direction
use panic_semihosting as _;
use cortex_m_rt::entry;
use cortex_m_semihosting::{dbg, heprint};
use stm32f3_discovery::button::UserButton;
@mikeshultz
mikeshultz / nimbus-eth2.toml
Last active September 14, 2022 21:35
Nimbus Consensus Layer config with Erigon
###
# Example Usage
# -------------
# nimbus_beacon_node --config-file $HOME/.config/nimbus-eth2.toml
###
network = "mainnet"
data-dir = "/data/ethereum/nimbus"
web3-url = ["http://127.0.0.1:8551"]
jwt-secret = "/data/ethereum/erigon/jwt.hex"
@mikeshultz
mikeshultz / OriginERC721.abi.py
Created September 3, 2021 19:45
Origin ERC721 Python ABI
ERC721_ABI = [{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"baseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":True,"internalType":"address","name":"owner","type":"address"},{"indexed":True,"internalType":"address","name":"approved","type":"address"},{"indexed":True,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":False,"inputs":[{"indexed":True,"internalType":"address","name":"owner","type":"address"},{"indexed":True,"internalType":"address","name":"operator","type":"address"},{"indexed":False,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":False,"inputs":[{"indexed":True,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":True,"internalType":"address","name":"newOwner","type":"address"}]
@mikeshultz
mikeshultz / Origin_ERC721v2.abi.json
Created September 3, 2021 19:39
Origin ERC721 ABI
[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"baseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"Owne
@mikeshultz
mikeshultz / dump_storage.py
Last active July 4, 2023 13:12
Dump the non-zero storage of an Ethereum contract
"""
Blindly dumps the storage of an Ethereum contract
This dumps non-zero slots:
- range(0, height)
- range(keccak(slot), keccak(slot) + width)
This script makes no attempt to decode them past Python byte strings.
"""
import sys
@mikeshultz
mikeshultz / brightness.py
Last active July 20, 2021 15:38
Python script to adjust the brightness of your laptop backlight
#!/bin/env python
"""
Adjust the brightness of your laptop's backlight. Good for use with Fluxbox
Usage:
/usr/bin/brightness.py --step 100 down /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight
Fluxbox config `~/.fluxbox/keys`:
#!/bin/env python3
"""
Detect any contracts that selfdestruct that interacted with a contract.
1) Look for code before, during, and after contract, any transition from
having code to having no code is suspect.
2) If not marked as suspect and no code found, look through etherscan for a
contract creation transaction in the account's history for good measure