Skip to content

Instantly share code, notes, and snippets.

View evert0n's full-sized avatar
:octocat:

Everton Yoshitani evert0n

:octocat:
View GitHub Profile
@evert0n
evert0n / Pipfile
Created September 28, 2020 14:13 — forked from onecrayon/Pipfile
async/await FastAPI with SQLAlchemy test
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
pylint = "*"
[packages]
sqlalchemy = "*"
@evert0n
evert0n / random_hash.sh
Created September 25, 2020 15:12 — forked from rietta/random_hash.sh
Easy command line random hash generator for Mac OS X, Linux, and FreeBSD.
#!/bin/sh
head -n 4096 /dev/urandom | openssl sha1
@evert0n
evert0n / audit_mixin.py
Created August 21, 2020 05:28 — forked from techniq/audit_mixin.py
Useful SQLAlchemy Mixins
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from flask_security import current_user
class AuditMixin(object):
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
@evert0n
evert0n / README.md
Created August 13, 2020 07:59 — forked from arikfr/README.md
Setting up HTTPS with LetsEncrypt for Redash Docker Deployment
  1. Make sure the domain you picked points at the IP of your Redash server.
  2. Switch to the root user (sudo su).
  3. Create a folder named nginx in /opt/redash.
  4. Create in the nginx folder two additional folders: certs and certs-data.
  5. Create the file /opt/redash/nginx/nginx.conf and place the following in it: (replace example.redashapp.com with your domain name)
    upstream redash {
        server redash:5000;
    }
    
~/load-testing via ⬢ v12.14.1 took 10m 2s
➜ k6 run --vus 100 --duration 10m liff-page.js
/\ |‾‾| /‾‾/ /‾/
/\ / \ | |_/ / / /
/ \/ \ | | / ‾‾\
/ \ | |‾\ \ | (_) |
/ __________ \ |__| \__\ \___/ .io
execution: local
@evert0n
evert0n / aws-lambda-static-type-checker.md
Created February 16, 2020 05:56 — forked from alexcasalboni/aws-lambda-static-type-checker.md
AWS Lambda Static Type Checker Example (Python3)

How to use Python3 Type Hints in AWS Lambda

TL;DR

Static Type Checkers help you find simple (but subtle) bugs in your Python code. Check out lambda_types.py and incrementally improve your code base and development/debugging experience with type hints.

Your Lambda Function code will go from this:

@evert0n
evert0n / remove_apt_cache
Created November 27, 2019 07:37 — forked from marvell/remove_apt_cache
Remove APT cache (for Dockerfile)
apt-get clean autoclean
apt-get autoremove --yes
rm -rf /var/lib/{apt,dpkg,cache,log}/
@evert0n
evert0n / fields.py
Created November 20, 2019 05:48 — forked from iamahuman/fields.py
Virtual Field for Django
from django.db.models import Field
from django.conf import settings
from django.utils.decorators import cached_property
class VirtualField(object):
"""
A virtual field, mainly used for caching and seamless computed field retrieval.
This acts both like a (cached) property and a virtual field if supported.
"""
@evert0n
evert0n / gh-issues-import.py
Created November 10, 2019 23:42 — forked from bavovna/gh-issues-import.py
GitHub repository issues import
import urllib2
import json
from StringIO import StringIO
import base64
#==== configurations =======
username = "user@example.com"
password = "naked_password"
src_repo = "octocat/Hello-World"
dst_repo = "helloworld-inc/Hello-World"
@evert0n
evert0n / add.sh
Created November 9, 2019 14:14 — forked from matti/add.sh
alpine docker add package from edge testing
apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
x11vnc