Skip to content

Instantly share code, notes, and snippets.

View s3rgeym's full-sized avatar
🏴‍☠️
РОСКОМНАДЗОР - дети шлюх

[object Object] s3rgeym

🏴‍☠️
РОСКОМНАДЗОР - дети шлюх
View GitHub Profile
In [10]: f = open('/dev/nvme2n1p2', 'rb')

In [11]: data = f.read()

In [12]: len(data)
Out[12]: 16777216

In [13]: data[0]
Out[13]: 0
In [5]: list(map(2 .__add__, [1, 2, 3]))
Out[5]: [3, 4, 5]
#!/bin/bash
USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
parse_sitemap() {
curl -sA "$USER_AGENT" "$1" | grep -oP '(?<=<loc>)[^<>]+'
}
parse_website() {
curl -sA "$USER_AGENT" "$1" | grep -oP '(?<=Required&#039;\);"> )[^<>]+'
}
#!/usr/bin/env python
from __future__ import annotations
import argparse
import dataclasses
import json
import logging
import re
import sys
from pathlib import Path
#!/usr/bin/env python
from __future__ import annotations
import argparse
import re
import sys
from functools import partial
from pathlib import Path
from types import SimpleNamespace
from typing import Any, Sequence
#!/bin/bash
UA='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36'
# сборище американских капиталистических свиней, зарабатывающих на геноциде русских и прочих н@гров
# shellcheck disable=SC2207
links=($(curl -A "$UA" -s 'https://stockanalysis.com/sitemap.xml' | grep -oP '(?<=<loc>)[^<>]+' | grep -P '/stocks/[^/]+/$'))
echo "total stock links: ${#links[@]}" >&2
for link in "${links[@]}"; do
sleep .3 # можно поставить меньше
endpoint="${link}company/"
echo "parse $endpoint" >&2
❯ torify ipython
Python 3.12.3 (main, Apr 23 2024, 09:16:07) [GCC 13.2.1 20240417]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.24.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import requests
In [2]: requests.get('http://ifconfig.me').text
Out[2]: '\n<html><head>\n<meta http-equiv="content-type" content="text/html;charset=utf-8">\n<title>403 Forbidden</title>\n</head>\n<body text=#000000 bgcolor=#ffffff>\n<h1>Error: Forbidden</h1>\n<h2>Your client does not have permission to get URL <code>/</code> from this server.</h2>\n<h2></h2>\n</body></html>\n'
#!/usr/bin/env python
import argparse
import functools
import os
import re
import sys
from contextlib import suppress
import requests
from bs4 import BeautifulSoup
// Загрузить следующие результаты
// $$('[aria-label="Ещё результаты"]')[0].click()
$$('div[data-dt="1"] > a[aria-label]')[0].click()
// Получить список ссылок
$$('[data-snhf="0"] a:nth-child(1)').map(a => a.href)