Skip to content

Instantly share code, notes, and snippets.

View Aviksaikat's full-sized avatar
💭
I tell people secrets, it makes them like me

Saikat Karmakar Aviksaikat

💭
I tell people secrets, it makes them like me
View GitHub Profile
@Aviksaikat
Aviksaikat / get_decimals_sol.py
Last active April 20, 2024 07:32
Get decimals of a token from SOLANA chain from a given address
from spl.token._layouts import MINT_LAYOUT
from solana.rpc.api import Client, Pubkey
http_client = Client("https://api.mainnet-beta.solana.com")
# WIF token address
addr = Pubkey.from_string("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v")
info = http_client.get_account_info(addr)
decimals = MINT_LAYOUT.parse(info.value.data).decimals
@Aviksaikat
Aviksaikat / pipx_upgrade.sh
Created April 9, 2024 15:59
one liner to upgrade all pipx packages
pipx list --short | cut -d ' ' -f1 | while read line; do pipx upgrade $line; done
@Aviksaikat
Aviksaikat / Filecoin-Station.desktop
Created March 5, 2024 19:06
desktop file for Filecoin Station AppImage
[Desktop Entry]
Name=Filecoin Station
Comment=Filecoin Station
Exec=/home/avik/tools/filecoin-station-linux-x86_64.AppImage
Icon=/home/avik/tools/icons-for-appImage/file-coin-station.jpg
Terminal=false
Type=Application
Categories=Development;
@Aviksaikat
Aviksaikat / ledger-live-desktop.desktop
Created March 5, 2024 19:05
Ledger Live Desktop App `.desktop` file for linux
[Desktop Entry]
Name=Ledger Live Desktop
Comment=Ledger Live Desktop App
Exec=/home/avik/tools/ledger-live-desktop-2.77.2-linux-x86_64.AppImage
Icon=/home/avik/tools/icons-for-appImage/ledger.webp
Type=Application
Terminal=false
Categories=Development;
@Aviksaikat
Aviksaikat / remove_old_snap.sh
Created January 20, 2024 14:27
remove old versions of snap packages
#!/bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
echo "Size before cleanup"
du -h /var/lib/snapd/snaps
set -eu
snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision;
from typing import (Tuple) # noqa: F401
import numpy as np
from web3 import Web3
from web3.auto import w3
from eth_account.messages import encode_defunct, _hash_eip191_message
from eth_keys import keys
from eth_keys.backends.native.ecdsa import (
@Aviksaikat
Aviksaikat / ICurvePool.sol
Created November 30, 2023 00:10
Interface for the curve pool contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
interface ICurvePool {
function get_virtual_price() external returns (uint256 out);
function add_liquidity(uint256[2] calldata amounts, uint256 deadline) external;
function get_dy(int128 i, int128 j, uint256 dx) external returns (uint256 out);
@Aviksaikat
Aviksaikat / ape-config.yaml
Created October 30, 2023 20:52
Interact with custom RPC URL using APE. Ideal for CTFs, local node testing
name: Project-Name
plugins:
- name: solidity
- name: alchemy
- name: foundry
- name: infura
- name: etherscan
ethereum:
default_network: mainnet-fork
mainnet_fork:
@Aviksaikat
Aviksaikat / deploy.sh
Created October 28, 2023 19:12
Deploy script to local nodes for testing challenges of paradigm CTF 2023
#!/bin/bash
ANVIL_RPC_URL="http://127.0.0.1:8545"
# make it background
anvil --fork-url $WEB3_INFURA_RPC --auto-impersonate &
cd challenge/project && forge script --rpc-url "$ANVIL_RPC_URL" script/Deploy.s.sol:Deploy --broadcast --unlocked --sender $(cast az)
@Aviksaikat
Aviksaikat / pyproject.toml
Created August 20, 2023 00:38
poetry config
[tool.poetry]
name = "Flash_loan_arbritage"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
readme = "README.md"
packages = [{include = "Flash_loan_arbritage"}]
[tool.poetry.dependencies]
python = ">=3.10,<3.11"