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
git clone --depth=1 https://github.com/microsoft/WSL2-Linux-kernel.git | |
sudo apt install -y build-essential flex bison libssl-dev libelf-dev libbabeltrace-dev libunwind-dev libdw-dev binutils-dev libiberty-dev | |
cd WSL2-Linux-kernel/tools/perf/ | |
make -j2 -s && make install |
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
>>> dis.dis(bench_match.mapping_match_logical) | |
63 0 LOAD_CONST 1 ('🐓') | |
2 LOAD_CONST 2 (1) | |
4 BUILD_MAP 1 | |
64 6 LOAD_CONST 2 (1) | |
8 LOAD_CONST 2 (1) | |
10 LOAD_CONST 3 (('🦊', '🌽')) | |
12 BUILD_CONST_KEY_MAP 2 |
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
[[[[[[[[[[[[[[[����������������������������������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[����������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[[[[[[[[[[[[[[[������������������������[[[[[[[[[[[[[[[[[[[[[����������������������������������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[����������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[[[[[[[[[[[[[[[������������������������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[[[[[[[[[[[[[[[��������������������������[[[[[[[[[[[[[[[������������������������[[[[[[[[[[[[[[[��[[[���������������������������������������[[[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[[[[[[[[[[[[[[[��������������������������[[[[[[[[[[[[[[[������������������������[[[[[[[[[[[[[[[��[[[���������������������������������������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[[[[[[[[[[[[[[[������������������������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[[[[[[[[[[[[[[[��������������������������[[[[[[���������������������������o de][���� ss2", ]] |
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
""" | |
Requirements -- | |
- orjson | |
- rich | |
Usage: | |
> grype /path/to/scan -o json > output.json | |
> python grype_print.py output.json | |
or |
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
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Pip Audit", | |
"type": "shell", | |
"command": "${command:python.interpreterPath}", | |
"args": ["-m", "pip_audit"], | |
"isBackground": true, | |
"group": "none", |
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 asyncio | |
import aiohttp | |
from itertools import islice, chain | |
LOGIN_FORM = 'http://asd.sdfsdf/admin' | |
LOGIN_URL = 'http://asd.fsdfsdf/admin' | |
TWOFA_FORM = 'http://asda.asdas/doAdminTwoFactor.action' | |
INVALID_MESSAGE = 'Invalid token, please try again' | |
def batch(iterable, size): |
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
""" | |
Usage: | |
>>> tracer.add_span_processor(BatchSpanProcessor(RichSpanExporter())) | |
""" | |
import datetime | |
import typing | |
from typing import Optional | |
import opentelemetry.trace |
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 azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter | |
from fastapi import FastAPI, Request | |
from fastapi.responses import JSONResponse | |
from opentelemetry.context import get_current as get_current_context | |
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor | |
from opentelemetry.sdk.trace import TracerProvider, _Span | |
from opentelemetry.sdk.trace.export import (BatchSpanProcessor, | |
ConsoleSpanExporter, | |
SimpleSpanProcessor) | |
from starlette.exceptions import HTTPException as StarletteHTTPException |
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 fastapi import FastAPI, Request | |
from fastapi.responses import HTMLResponse | |
from profiler import FastApiProfiler | |
app = FastAPI() | |
import .routes # NOQA | |
PROFILING = True # Put this in Settings when you're ready |