Skip to content

Instantly share code, notes, and snippets.

View afr-dt's full-sized avatar
:octocat:

Alejandro Flores afr-dt

:octocat:
  • Personal
  • Mexico City
View GitHub Profile
@afr-dt
afr-dt / grpcio_apple_silicon.sh
Created October 10, 2022 22:31
grpcio install on Apple Silicon
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1
pip install grpcio
@afr-dt
afr-dt / fix-dyld-missing-symbol-called-errors-on-m1-macs.md
Created April 26, 2022 19:25 — forked from adrienjoly/fix-dyld-missing-symbol-called-errors-on-m1-macs.md
Fix `dyld[]: missing symbol called` errors when running Node.js programs on M1 Macs

Problem

If you're getting this kind of error when running Node.js programs with binary dependencies that don't support M1 yet, e.g.:

$ yarn test
dyld[51175]: missing symbol called
dyld[51176]: missing symbol called
# syntax=docker/dockerfile:1
FROM python:3.8-slim-buster
WORKDIR /app
ENV ACCEPT_EULA=Y
RUN apt-get update -y && apt-get update \
&& apt-get install -y --no-install-recommends curl gcc g++ gnupg unixodbc-dev
@afr-dt
afr-dt / iterm2.md
Created November 26, 2021 16:59 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@afr-dt
afr-dt / accessing_dict_keys_like_an_attribute.py
Created November 25, 2021 21:47
accessing_dict_keys_like_an_attribute
class AttrDict(dict):
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__ = self
config = AttrDict()
# Example
config['name']
@afr-dt
afr-dt / s3_presigned_image_url.py
Last active June 4, 2021 18:22
Generate a presigned URL from S3 image
import boto3
import logging
from botocore.exceptions import ClientError
class S3Imgs:
def __init__(self, aws_access_key_id, aws_secret_access_key, region_name):
"""S3 secrests config.
@afr-dt
afr-dt / requests_logging.py
Last active January 27, 2021 00:16
Python requests logging
import logging
from http.client import HTTPConnection
def httpclient_logging():
HTTPConnection.debuglevel = 1
requests_log = logging.getLogger("urllib3")
requests_log.setLevel(logging.WARNING)
@afr-dt
afr-dt / clean_empty_or_none.py
Created January 18, 2021 07:14
Clean empty or None values from dict
def clean_empty_or_none(d):
"""
Clean empty or None values from dict
"""
clean = {}
for k, v in d.items():
if isinstance(v, dict):
nested = clean_empty_or_none(v)
if len(nested.keys()) > 0:
clean[k] = nested
@afr-dt
afr-dt / validate_phone.py
Created January 8, 2021 20:01
Validate phone with + symbol
import re
def validate_phone(phone):
if re.match(r'^\+1?\d{9,15}$', phone):
print(f'{phone} is valid number')
else:
print(f'{phone} is not valid')