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 subprocess | |
import time | |
from asgiref.sync import sync_to_async | |
async def delete_revision(function_name, revision): | |
cmd = f"aws lambda delete-function --function-name {function_name}:{revision}" | |
print(cmd) |
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 sys | |
from math import ceil, floor | |
from hashids import Hashids | |
target_length = 8 | |
hashids = Hashids(min_length=target_length) | |
print(f"target_length={target_length}") |
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
""" | |
Camelize FastAPI path params and query params. | |
For body params and responses, use pydantic model's alias_generator config. | |
""" | |
from fastapi import FastAPI | |
from fastapi.dependencies.models import Dependant | |
from fastapi.routing import APIRoute | |
from humps import camelize |
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
/* | |
* GitHub CSS for MacDown | |
* https://gist.github.com/devxoul/8df5792ce330985a633b | |
* http://sindresorhus.com/github-markdown-css/ | |
*/ | |
@font-face { | |
font-family: octicons-link; | |
src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYF |
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 copy import copy | |
from typing import Generic, Optional, TypeVar, get_args, get_type_hints | |
from pydantic import BaseModel | |
from pydantic.errors import ConfigError | |
from pydantic.typing import convert_generics | |
T = TypeVar('T', bound=BaseModel) | |
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
# -*- coding: utf-8 -*- | |
""" | |
This code won't be updated anymore. | |
Project has moved to repository: https://github.com/devxoul/korail | |
""" | |
import requests | |
from bs4 import BeautifulSoup | |
from datetime import datetime |
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
# -*- coding: utf-8 -*- | |
from datetime import datetime | |
import urllib2 | |
def kb_balance(account, password, resident, username): | |
""" | |
국민은행 계좌 잔액 빠른조회. 빠른조회 서비스에 등록이 되어있어야 사용 가능. | |
빠른조회 서비스: https://obank.kbstar.com/quics?page=C018920 |
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
extension UICollectionView { | |
public var rx_reachedBottom: Observable<Void> { | |
return self.rx.contentOffset | |
.map { contentOffset in | |
var responder: UIResponder = self | |
var viewController: UIViewController? = nil | |
while let next = responder.next { | |
viewController = next as? UIViewController | |
if viewController != nil { |
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
#!/bin/bash | |
# Auto increment Version number when Archive | |
if [ $CONFIGURATION == Release ]; then | |
VERSIONNUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}") | |
NEWSUBVERSION=`echo $VERSIONNUM | awk -F "." '{print $3}'` | |
NEWSUBVERSION=$(($NEWSUBVERSION + 1)) | |
NEWVERSIONSTRING=`echo $VERSIONNUM | awk -F "." '{print $1 "." $2 ".'$NEWSUBVERSION'" }'` | |
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $NEWVERSIONSTRING" "${PROJECT_DIR}/${INFOPLIST_FILE}" |
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
class RequiredIf(object): | |
"""Validates field conditionally. | |
Usage:: | |
login_method = StringField('', [AnyOf(['email', 'facebook'])]) | |
email = StringField('', [RequiredIf(login_method='email')]) | |
password = StringField('', [RequiredIf(login_method='email')]) | |
facebook_token = StringField('', [RequiredIf(login_method='facebook')]) | |
""" |
NewerOlder