Skip to content

Instantly share code, notes, and snippets.

View kalloc's full-sized avatar
🌋

kalloc kalloc

🌋
View GitHub Profile
0x03370cdcebf324eca54c7e57a9b87279ab930db5
0x037da3d166fea179a26275d1f041a22b18dfeb13
0x03f2ac95d325d9741cd24e3b339ddc80eff602a7
0x05da74584002cb8a6ad9e2b348ce029cbcdebea3
0x070fa1333c8c7753fe2545264de75021912c1aea
0x07bd138587c4453e83f2fbf0ede07f40fe39afa4
0x0b11d0591b71b592c7ea6d1218b76f74619d1a53
0x0bf47b7b8c52a5ad13ed1689eb223fb2166173ff
0x0c864b36098bac35b0daeef762cd5de3d3378919
0x0e1f59769ce81cef9c0708077f1d487a3b4c31f3
@kalloc
kalloc / parser.py
Created April 2, 2024 23:31
protoc-gen -decode parser
import sys
import json
import re
import base58 as bs58
from lark import Lark, Transformer
grammar = """
?start: item+
use borsh::{BorshDeserialize, BorshSerialize};
use shank::ShankInstruction;
use solana_program::{
account_info::AccountInfo, declare_id, entrypoint, entrypoint::ProgramResult, msg,
pubkey::Pubkey,
};
pub fn win_check(moves: [u32; 9]) -> u32 {
// Player 1 move will be marked as 1 and player 2 as 2
let [m1, m2, m3, m4, m5, m6, m7, m8, m9] = moves;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* AES implementation in JavaScript (c) Chris Veness 2005-2010 */
/* - see http://csrc.nist.gov/publications/PubsFIPS.html#197 */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
var Aes = {}; // Aes namespace
/**
* AES Cipher function: encrypt 'input' state with Rijndael algorithm
* applies Nr rounds (10/12/14) using key schedule w for 'add round key' stage
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
key = open('key.bin', 'rb').read()
iv = open('iv.bin', 'rb').read()
shard1 = open('shard1.bin', 'rb').read()
ciphertext = shard1
# Initialize AES-GCM cipher
cipher = Cipher(
use cosmwasm_std::{Response, StdResult};
use cw_storage_plus::Item;
use sylvia::{contract, entry_points};
use sylvia::types::{InstantiateCtx, QueryCtx};
use crate::response::CounterResponse;
pub struct Counter {
pub(crate) count: Item<'static, u64>,
import os
import sys
import pymysql
import pymysql.cursors
import requests
from lxml import html
DB_PASS = os.environ.get('DB_PASS')
DB_NAME = os.environ.get('DB_NAME')
const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.WebsocketProvider(process.env.ENDPOINT));
const transferSignature = Web3.utils.keccak256("Transfer(address,address,uint256)");
// Listen for Transfer events from all contracts
web3.eth.subscribe('logs', {
topics: [transferSignature]
}, (error, event) => {
if (error) {
@kalloc
kalloc / x.py
Created December 31, 2022 09:49
from telethon import TelegramClient, events, sync
import numpy as np
import asyncio
import random
from telethon.tl.functions.account import UpdateProfileRequest
from telethon.tl.functions.messages import SendReactionRequest
from telethon.tl.types import IpPort, ReactionEmoji
import torch
import os
import sys
@kalloc
kalloc / composer.json
Last active September 19, 2022 08:17
Ethereum Message Signing on PHP
{
"minimum-stability":"dev",
"autoload": {
"psr-4": {
"Ethereum\\": "src/"
}
},
"repositories": [
{
"type": "git",