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
pragma solidity =0.5.16; | |
import './interfaces/IUniswapV2ERC20.sol'; | |
import './libraries/SafeMath.sol'; | |
contract UniswapV2ERC20 is IUniswapV2ERC20 { | |
using SafeMath for uint; | |
string public constant name = 'Uniswap V2'; | |
string public constant symbol = 'UNI-V2'; |
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
# Install vscode extensions | |
code --install-extension 'abusaidm.html-snippets | |
alefragnani.Bookmarks | |
donjayamanne.python-extension-pack | |
HookyQR.beautify | |
hoovercj.vscode-power-mode | |
James-Yu.latex-workshop | |
janisdd.vscode-edit-csv | |
magicstack.MagicPython |
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 PyPDF2 import PdfFileReader, PdfFileMerger | |
pdf_merger = PdfFileMerger() | |
f = open('book.pdf', 'rb') | |
pdf_merger.append(f) | |
offset = 25 | |
addbm = pdf_merger.addBookmark | |
addbm('Contents', 5) |
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 os | |
from os.path import abspath, exists, join, isdir, basename, dirname | |
def list_abs(root, files=True, dirs=False): | |
for path in os.listdir(root): | |
path = abspath(join(root, path)) | |
if isdir(path): | |
if dirs: yield path | |
yield from list_abs(path) | |
else: |
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
# How to open an image file | |
from PIL import Image | |
img = Image.open(img_path) | |
# How to draw a bounding box with PIL | |
from PIL import Image, ImageDraw | |
def draw_bbox(img: Image, label: tuple): | |
# Starting from upper left corner |
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
# This instruction is for Unix-like OS users. | |
# I refered to the following guide when I wrote it. | |
# https://conda.io/docs/user-guide/tasks/build-packages/recipe.html | |
# Activate an environment if needed | |
conda activate myenv | |
# Install conda-build if you haven't. Ironically, installing conda-build | |
# includes installing python. This python will be effectively replaced with | |
# your new python binary so don't worry. |