Skip to content

Instantly share code, notes, and snippets.

View itherunder's full-sized avatar
🏠
Working from home

itherunder

🏠
Working from home
View GitHub Profile
@itherunder
itherunder / sig.txt
Created February 22, 2022 04:32
tezos profile signature
I am attesting that this GitHub handle itherunder is linked to the Tezos account tz1cBabDyuEqavNuRwoFoen5fH5Lmy8vufak for tzprofiles
sig:edsigteN16Zy81qXFw3ECVeDjw3HXKUzm8vJk5MUCdNrFhVR8ogLTtDiyvAn4hKwdMJ5ydSqm8TnUPaTw15jP9BjGqNfu96PTHg
@itherunder
itherunder / fibonacci.go
Created December 30, 2021 09:36
just learn,golang 使用闭包实现一个fibonacci 函数
package main
import "fmt"
// 返回一个“返回int的函数”
func fibonacci() func() int {
a, b := 1, 0
return func() int {
a, b = a+b, a
return b
@itherunder
itherunder / newton_sqrt.go
Created December 30, 2021 08:24
牛顿法求sqrt,就是拿表达式去逼近0,然后每次更替的时候就需要除以表达式的导数
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
var z float64 = 1
for math.Abs(z*z-x) > 0.0001 {
@itherunder
itherunder / listen_eth_bsc.py
Created December 30, 2021 04:16
监听以太坊和bsc 上面的Transfer 或者Swap 事件的,还能监听特定地址
__author__ = 'itherunder'
'''
https://etherscan.io/tokens?ps=100&p=1,从这里拿的
coins = document.getElementsByClassName('text-primary')
res = []
for (let i = 0; i < 100; i++) {
var name = coins[i].text
var href = coins[i].href
console.log(name, href)
res.push([name, href])
@itherunder
itherunder / call_contract_mint.py
Created December 29, 2021 10:58
使用web3py 自动化调用智能合约脚本,在Polygon上面玩的
from eth_typing.evm import Address
from web3 import Web3
import time
NODE_URL = "YOUR NODE URL(https://admin.moralis.io/speedyNodes获取)"
w3 = Web3(Web3.HTTPProvider(NODE_URL))
vis = {}
with open('vis.txt', 'r') as r:
for l in r:
@itherunder
itherunder / get_paper_title_bib_download_url.py
Created December 20, 2021 03:47
通过search_word 在谷歌学术上搜索论文并获取论文标题、bib引用、下载链接以及摘要,目前只搞了论文标题和下载链接
from genericpath import getctime
from urllib import parse
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.utils import download_file
search_word = 'ethereum smart contract'
query = '+'.join(search_word.split(' '))
url = 'https://scholar.google.com/scholar?hl=en&start=%d&q=%s'
@itherunder
itherunder / read_info_from_file.py
Created December 20, 2021 02:47
Python读取docx, pdf, xlsx
from logging import info
import os, pdfplumber, docx, xlrd
import sys
from win32com import client as wc
def doc2docx(file):
word = wc.Dispatch("Word.Application")
doc = word.Documents.Open(doc_path+'/'+file)
doc.SaveAs(doc_path+'/'+'{}x'.format(file), 12)
doc.Close()
@itherunder
itherunder / auto_follow.py
Last active January 18, 2022 13:47
`Monaco` 自动`follow` 脚本,`Python`,记得`pip3 install pyautogui`
import pyautogui, time, random, sys, os
def send_email(msg):
msg = msg.replace(' ', '_')
os.system('send_mail.exe %s' % msg)
def into_followers():
loc = pyautogui.locateCenterOnScreen("followers.png", confidence=0.9)
while loc is None:
print('[INFO] Cannot find followers.')
@itherunder
itherunder / gen_pri_addr.go
Last active January 18, 2022 13:48
生成以太坊地址和私钥,Golang版本,记得go get go-ethereum
package main
import (
"bufio"
"crypto/ecdsa"
crand "crypto/rand"
"fmt"
"io"
"log"
"net/smtp"
@itherunder
itherunder / gen_pri_addr.js
Created December 17, 2021 06:04
生成以太坊钱包地址和私钥,JavaScript版本,记得`npm install ethereumjs-wallet`
var Wallet = require('ethereumjs-wallet')
const fs = require('fs');
// 生成 i 个钱包地址数量,改这里就可以了。 TeleGram:@btcok9
for(var i = 0; i < 100; i++){
const EthWallet = Wallet.default.generate(false);
const addressALL = EthWallet.getAddressString();
const addr = addressALL + "\n";
console.log("address: " + EthWallet.getAddressString());