Skip to content

Instantly share code, notes, and snippets.

View thanakijwanavit's full-sized avatar
🎯
Focusing

Nic Wanavit thanakijwanavit

🎯
Focusing
View GitHub Profile
@thanakijwanavit
thanakijwanavit / loadawscred.py
Last active June 23, 2021 14:34
aws key installation in colab with aes pw encryption
from nicHelper.colab import autoSetupAws
from getpass import getpass
path = '/content/drive/MyDrive/.test'
autoSetupAws(path=path,
password = getpass('enter your password').encode(),
region='ap-southeast-1' )
@thanakijwanavit
thanakijwanavit / convertBase.py
Created April 19, 2021 06:58
convert int to base x
numpy.base_repr(10, base=3)
@thanakijwanavit
thanakijwanavit / deploy.yaml
Last active May 6, 2021 16:53
github action spec for deploy sam project
name: deploy
on:
push:
branches:
- 'master'
jobs:
build:
name: build
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thanakijwanavit
thanakijwanavit / clean_alt_list.py
Last active April 16, 2021 03:04
convert string list to list in dataframe
# for a list that looks like this
'''
“[strawberry, apple, orange]”
[credit](https://towardsdatascience.com/dealing-with-list-values-in-pandas-dataframes-a177e534f173)
'''
def clean_alt_list(list_):
list_ = list_.replace(', ', '","')
list_ = list_.replace('[', '["')
list_ = list_.replace(']', '"]')
@thanakijwanavit
thanakijwanavit / marshMallowSchema.py
Created April 13, 2021 03:07
example of using marshmallow with json schema
from marshmallow import Schema, fields
from marshmallow_jsonschema import JSONSchema
class UserSchema(Schema):
name = fields.String()
address = fields.String()
class Athlete(object):
user_schema = UserSchema()
def __init__(self):
@thanakijwanavit
thanakijwanavit / pynamodbCreate.py
Created April 9, 2021 07:52
create pynamodb table with pay per use
Model.create(billing_mode='PAY_PER_REQUEST)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thanakijwanavit
thanakijwanavit / chunk.py
Created April 1, 2021 05:49
chunking a list
def chunk(items:(list, str), sz:int)->Iterable:
return [items[i:i + sz] for i in range(0, len(items), sz)
@thanakijwanavit
thanakijwanavit / getPickingEndpoint.txt
Last active August 17, 2021 06:05
pickingEndpointforSK
https://otuyrsy65a.execute-api.ap-southeast-1.amazonaws.com/Prod/getOrder