Skip to content

Instantly share code, notes, and snippets.

View WP-LKL's full-sized avatar
🎉
I may be slow to respond

Lars K.L. WP-LKL

🎉
I may be slow to respond
View GitHub Profile
@WP-LKL
WP-LKL / batchImageDownloader.py
Last active March 28, 2021 14:30
Minimalist parallel image downloading with python. Please consult TOS/robots.txt prior to use.
import concurrent.futures
import urllib.request
import uuid
import requests
def getURLs(filename : str) -> list:
with open(filename, 'r') as f:
urls = f.read().splitlines()
return urls
@WP-LKL
WP-LKL / scrollScrape.py
Last active March 13, 2021 17:19
Scraping dynamic scrollable sites like Pinterest with selenium and bs4. //Please consult website TOS/robots.txt prior to use.
from selenium import webdriver
from bs4 import BeautifulSoup
import io
import time
# Any infinity scroll URL
var = "machinelearning"
url = "https://pinterest.com/search/pins/?q=" + var
ScrollNumber = 10 # The depth we wish to load
sleepTimer = 1 # Waiting 1 second for page to load
@WP-LKL
WP-LKL / scrapeTumblr.py
Last active March 13, 2021 17:19
Scraping images from Tumblr via Tumblr API (pytumblr). //Please consult website TOS/robots.txt prior to use.
import pytumblr
import io
def get_all_posts(client, blog):
offset = 0
while True:
# Note: similar for ``client.tagged()`` etc.
response = client.posts(blog, limit=20, offset=offset, reblog_info=True, notes_info=True)
posts = response['posts']
if not posts: return
@WP-LKL
WP-LKL / BscRawTx.ts
Created March 4, 2021 13:34
Binance Smart Chain transaction using web3 and ethereumjs with custom chain and commandline for python.
// Ex. $ npx ts-node BscRawTx.ts --txData=<txData>
// Consult: https://github.com/WP-LKL/bscValueDefi-Exploit, for python use-case
const Tx = require('ethereumjs-tx').Transaction;
const Web3 = require('web3');
import Common from 'ethereumjs-common';
import {parse} from 'ts-command-line-args';
interface input {
txData: string;