Skip to content

Instantly share code, notes, and snippets.

View squeaky-pl's full-sized avatar

Paweł Piotr Przeradowski squeaky-pl

View GitHub Profile
In [32]: s3_url = "s3://<access key id>:<secret access key>@oss-eu-central-1.aliyuncs.com/<bucket name>"
In [33]: parsed_s3_url = urllib.parse.urlparse(s3_url)
In [34]: session = boto3.Session(aws_access_key_id=parsed_s3_url.username,aws_secret_access_key=parsed_s3_url.password)
In [35]: s3_config = botocore.config.Config(signature_version="s3v4", s3={"addressing_style": "virtual"})
In [36]: client = session.client("s3", endpoint_url=f"https://{parsed_s3_url.hostname}", config=s3_config)
@squeaky-pl
squeaky-pl / without.py
Created June 19, 2021 10:38
Select all except some columns POC
# https://twitter.com/catherinedevlin/status/1406056592332648450
import sqlparse
from sqlparse import tokens
from sqlparse.sql import Identifier
from sqlparse.sql import IdentifierList
from sqlparse.sql import Token
type_pattern = [tokens.Wildcard, tokens.Whitespace, tokens.Keyword, tokens.Whitespace]
1. Go to https://addons.mozilla.org/en-US/firefox/addon/us-english-dictionary and install English United States Dictionary
2. Go to about:config and toggle extensions.langpacks.signatures.required to false, and xpinstall.signatures.required to false.
We will be editing the extension in-place and it cannot be signed by Mozilla
3. You need to close Firefox since we will be editing extension in use
4. Go to your Firefox profile directory (C:\Users\squeaky\AppData\Roaming\Mozilla\Firefox\Profiles\<id>\extensions), and
find @unitedstatesenglishdictionary.xpi, open it with 7zip or other archiving program and edit dictionaries/en-US.dic.
Be sure that after opening this file the file is replaced in the archive in-place. Alternatively you can unpack the whole .xpi
and then pack it again.
Each word is stored on a separate line terminated in UNIX \n line ending.
Sending build context to Docker daemon 34.33MB
Step 1/3 : FROM ubuntu:bionic
---> 775349758637
Step 2/3 : ADD pypy3.6-7.2.0-linux_x86_64-portable.tar.bz2 .
---> Using cache
---> 10194e523d0b
Step 3/3 : RUN pypy3.6-7.2.0-linux_x86_64-portable/bin/python3 -c 'import ssl; print(ssl.get_default_verify_paths())' ---> Running in c56f957f5ab2
DefaultVerifyPaths(cafile='/pypy3.6-7.2.0-linux_x86_64-portable/lib-python/3/cacert.pem', capath=None, openssl_cafile_env='SSL_CERT_FILE', openssl_cafile=None, openssl_capath_env='SSL_CERT_DIR', openssl_capath=None)
Removing intermediate container c56f957f5ab2
---> 791aa859ec66
vanilla.json
============
Performance version: 0.9.1
Python version: PyPy 7.2.0 (Python 3.6.9) (64-bit) revision 5da45ced70e515f94686be0df47c59abd1348ebc
Report on Linux-4.19.79-microsoft-standard-x86_64-with-debian-buster-sid
Number of logical CPUs: 8
Start date: 2019-11-17 07:08:00.982525
End date: 2019-11-17 08:29:37.726308
When using my system Python3.6 I can succesfully install mercurial==5.0.2
~/w/portable-pypy ❯❯❯ HGPYTHON3=1 python3.6 -m pip install mercurial==5.0.2 ✘ 1 master ✱ ◼ Collecting mercurial==5.0.2
Cache entry deserialization failed, entry ignored
Installing collected packages: mercurial
Successfully installed mercurial-5.0.2
When using pypy3.6-7.2.0 I get the stacktrace
~/w/portable-pypy ❯❯❯ HGPYTHON3=1 venv-fswitches/bin/pypy -m pip install mercurial==5.0.2 master ✱ ◼ Collecting mercurial==5.0.2
*** failed to build the CFFI modules ['_ssl_build.py']
PyPy can still be used as long as you don't need the corresponding
modules. If you do need them, please install the missing headers and
libraries (see error messages just above) and then re-run the command:
/src/pypy/pypy3-c /src/pypy/pypy/tool/build_cffi_imports.py
[1269ca] translation-task}
[translation:info] usession directory: /src/usession-release-pypy3.5-v5.8.0-0
CURIO + H11 HTTP
python3 -m perfkit python zenhttp_curio_h11.py wrk --script zenhttp.lua --repeat 5
.....
3001.37, 3327.0, 3256.87, 3236.13, 3226.81
root@scw-421e6f:~/zenchmarks# python3 -m perfkit python --binary ~/pypy-c-jit-90326-88ef793308eb-linux64/bin/pypy3 zenhttp_curio_h11.py wrk --script zenhttp.lua --repeat 20
....................
3032.0, 10580.4, 12895.31, 12346.35, 12926.48, 11933.18, 12356.87, 12586.28, 12453.64, 12197.66,
12460.54, 12527.95, 12360.43, 12417.06, 12398.75, 12424.73, 12227.52, 12433.75, 12435.42, 12428.29
cat /etc/*release
Fedora release 24 (Twenty Four)
NAME=Fedora
VERSION="24 (Workstation Edition)"
ID=fedora
VERSION_ID=24
PRETTY_NAME="Fedora 24 (Workstation Edition)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:24"
registry = {
'db': 'my database',
'redis': 'my redis',
'settings': 'my settings'
}
def inject(func):
def wrapper(*args, **kwargs):
injected = {k: registry[dep] for k, dep in func.__annotations__.items()}