Skip to content

Instantly share code, notes, and snippets.

@paramono
paramono / .deps...npm...hardhat...console.sol
Created December 7, 2023 21:18
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.22+commit.4fc1097e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
library console {
address constant CONSOLE_ADDRESS =
0x000000000000000000636F6e736F6c652e6c6f67;
function _sendLogPayloadImplementation(bytes memory payload) internal view {
address consoleAddress = CONSOLE_ADDRESS;
/// @solidity memory-safe-assembly
@paramono
paramono / 00-detect-virtualenv-sitepackages.py
Created April 22, 2018 13:07 — forked from henriquebastos/00-detect-virtualenv-sitepackages.py
IPython startup script to detect and inject VIRTUAL_ENV's site-packages dirs.
"""IPython startup script to detect and inject VIRTUAL_ENV's site-packages dirs.
IPython can detect virtualenv's path and injects it's site-packages dirs into sys.path.
But it can go wrong if IPython's python version differs from VIRTUAL_ENV's.
This module fixes it looking for the actual directories. We use only old stdlib
resources so it can work with as many Python versions as possible.
References:
http://stackoverflow.com/a/30650831/443564
@paramono
paramono / proxy.sh
Created September 26, 2016 09:11
SSH tunneling
ssh -D port -C -N user@server
setxkbmap -model pc105 -layout pl,ru -variant legacy, -option grp:alt_shift_toggle,grp_led:scroll
@paramono
paramono / django_locale.py
Created August 15, 2016 09:09
List of steps to make and compile translation messages in django
cd /path/to/your_django_app/
mkdir locale
django-admin makemessages -l ru # or other languages
# (edit translations in /locale directory)
django-admin compilemessages
@paramono
paramono / spf.txt
Created August 14, 2016 12:46
Correct SPF configuration for Yandex-delegated domains
@ TXT v=spf1 ip4:yourip4 ip6:yourip6 include=_spf.yandex.net ~all
@paramono
paramono / commit-amend.sh
Last active August 11, 2016 19:44
Add files you forgot to add to last commit (amend)
# edited file-that-i-remember.txt
git add file-that-i-remember.txt
git commit
# realize you forgot a file
git add file-that-i-forgot.txt
git commit --amend --no-edit
# if the original commit (the one without the file you forgot to add) was pushed to a remote repo, you may need to push amended commit with --force:
git push origin master --force
@paramono
paramono / migration_relocation.py
Last active August 11, 2016 16:22
A short snippet for django settings that stores migrations for every app in a directory of your preference (project/migrations/ in this example)
def get_migration_apps():
migration_apps = []
for module in INSTALLED_APPS:
try:
app = module.rsplit('.', 1)[1]
except IndexError:
app = module
migration_apps.append(app)
return migration_apps
@paramono
paramono / .gitconfig
Last active August 10, 2016 10:33
Simple .gitconfig with some handy aliases. Don't forget to replace %name% and %email% with your data!
[user]
name = %name%
email = %email%
[credential]
helper = cache
[core]
editor = gvim -f
excludesfile = ~/.gitignore
[diff]
tool = gvimdiff