Skip to content

Instantly share code, notes, and snippets.

@quan118
quan118 / gist:33b81f6aa612272669ba07c8fe63f296
Created March 28, 2022 08:12
Ether js signedTypeData & metamask sig utils signedTypeData_v4 sample
const {signTypedData, SignTypedDataVersion} = require("@metamask/eth-sig-util");
const ethers = require("ethers");
const domain = {
name: "name",
version: "1",
verifyingContract: "0xB6Fa4E9B48F6fAcd8746573d8e151175c40121C7",
chainId: 1,
};
@tbutts
tbutts / tmux-migrate-options.py
Last active February 29, 2024 08:11
For tmux configs: Merge deprecated/removed -fg, -bg, and -attr options into the -style option
#!/usr/bin/env python
# vim: set fileencoding=utf-8
#
# USAGE:
# Back up your tmux old config, run the script and redirect stdout to your conf
# file. Example:
#
# $ cp ~/.tmux.conf ~/.tmux.conf.orig
# $ python ./tmux-migrate-options.py ~/.tmux.conf.orig > ~/.tmux.conf
#
@treyhunner
treyhunner / choice_enum.py
Created April 9, 2018 23:49
Enum for use with Django ChoiceField
from enum import Enum, EnumMeta
class ChoiceEnumMeta(EnumMeta):
def __iter__(self):
return ((tag, tag.value) for tag in super().__iter__())
class ChoiceEnum(Enum, metaclass=ChoiceEnumMeta):
"""