Skip to content

Instantly share code, notes, and snippets.

View bombs-kim's full-sized avatar
🎯
Focusing

Beomsoo Kim bombs-kim

🎯
Focusing
View GitHub Profile
@bombs-kim
bombs-kim / uniswap-v2-core...contracts...UniswapV2ERC20.sol
Last active July 6, 2021 03:00
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
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';
# 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
@bombs-kim
bombs-kim / pypdf_add_bookmarks_pdf.py
Last active March 4, 2020 10:20
How to add bookmarks to pdf using python pypdf2
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)
@bombs-kim
bombs-kim / path_utils.py
Last active January 16, 2019 05:32
paths_utils.py
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:
@bombs-kim
bombs-kim / misc.py
Last active January 8, 2019 07:05
jupyter misc
# 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
@bombs-kim
bombs-kim / install_custom_python_in_conda.sh
Created December 27, 2018 14:53
How to install a custom python binary(ex. python-dbg) in your conda environment.
# 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.