This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python3 | |
import tweepy | |
import time | |
def limit_handled(cursor): | |
while True: | |
try: | |
yield next(cursor) | |
except tweepy.errors.TooManyRequests as e: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Fisa-vim-config | |
" http://fisadev.github.io/fisa-vim-config/ | |
" version: 8.3.1 | |
" ============================================================================ | |
" Vim-plug initialization | |
" Avoid modify this section, unless you are very sure of what you are doing | |
" Vim Tab as 4 Spaces | |
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
// from https://github.com/libarchive/libarchive/blob/master/contrib/untar.c | |
/* | |
* This file is in the public domain. Use it as you see fit. | |
*/ | |
/* | |
* "untar" is an extremely simple tar extractor: | |
* * A single C source file, so it should be easy to compile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BUF_SZ 16384 | |
void my_gunzip(gzFile_s *src, FILE *dest) { | |
unsigned char buf[BUF_SZ]; | |
for (auto sz = gzread(src, buf, BUF_SZ); sz > 0; sz = gzread(src, buf, BUF_SZ) { | |
std::fwrite(buf, 1, BUF_SZ, dest); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
if __name__ == "__main__": | |
line_count = 0 | |
with open("/Users/dendisuhubdy/Downloads/redpanda/data/2/kafka/btc_usdt_spot/0_111/0-1-v1.log", "rb") as fp: | |
Lines = fp.readlines() | |
for line in Lines: | |
print(line) | |
if line_count == 1: | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ecdsa import SigningKey, SECP256k1 | |
from sha3 import keccak_256 | |
import click | |
@click.command() | |
@click.argument('count', type=click.types.IntRange(1, 1000), default=1) | |
def main(count): | |
for i in range(count): | |
priv, addr = generate_pair() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from web3 import Web3, HTTPProvider | |
from eth_utils import encode_hex, event_signature_to_log_topic | |
from eth_abi import encode_single | |
w3 = Web3(HTTPProvider('http://127.0.0.1:8545', {'timeout': 120})) | |
transfer_topic = encode_hex(event_signature_to_log_topic('Transfer(address,address,uint256)')) | |
def get_tokens(address): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import click | |
LTO_NODE_URL = 'http://127.0.0.1:6869' | |
LTO_API_KEY = '<your api password>' | |
s = requests.session() | |
s.headers['X-API-Key'] = LTO_API_KEY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. generate keys with `lighthouse account validator new random N` | |
# 2. run `python deposit.py`, it skips the ones already deposited and deposits the rest | |
import json | |
import sys | |
from pathlib import Path | |
from getpass import getpass | |
from eth_utils import encode_hex, decode_hex | |
from web3 import Web3 | |
from web3.middleware import construct_sign_and_send_raw_middleware |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
country_list = [{'Code': 'AF', 'Name': 'Afghanistan'}, {'Code': 'AX', 'Name': 'Åland Islands'}, {'Code': 'AL', 'Name': 'Albania'}, {'Code': 'DZ', 'Name': 'Algeria'}, {'Code': 'AS', 'Name': 'American Samoa'}, {'Code': 'AD', 'Name': 'Andorra'}, {'Code': 'AO', 'Name': 'Angola'}, {'Code': 'AI', 'Name': 'Anguilla'}, {'Code': 'AQ', 'Name': 'Antarctica'}, {'Code': 'AG', 'Name': 'Antigua and Barbuda'}, {'Code': 'AR', 'Name': 'Argentina'}, {'Code': 'AM', 'Name': 'Armenia'}, {'Code': 'AW', 'Name': 'Aruba'}, {'Code': 'AU', 'Name': 'Australia'}, {'Code': 'AT', 'Name': 'Austria'}, {'Code': 'AZ', 'Name': 'Azerbaijan'}, {'Code': 'BS', 'Name': 'Bahamas'}, {'Code': 'BH', 'Name': 'Bahrain'}, {'Code': 'BD', 'Name': 'Bangladesh'}, {'Code': 'BB', 'Name': 'Barbados'}, {'Code': 'BY', 'Name': 'Belarus'}, {'Code': 'BE', 'Name': 'Belgium'}, {'Code': 'BZ', 'Name': 'Belize'}, {'Code': 'BJ', 'Name': 'Benin'}, {'Code': 'BM', 'Name': 'Bermuda'}, {'Code': 'BT', 'Name': 'Bhutan'}, {'Code': 'BO', 'Name': 'Bolivia, Plurinational State of'}, {' |