Skip to content

Instantly share code, notes, and snippets.

View jeakwon's full-sized avatar

Jea Kwon jeakwon

View GitHub Profile
@jeakwon
jeakwon / extract_ILSVRC.sh
Created June 27, 2023 11:59 — forked from BIGBALLON/extract_ILSVRC.sh
script for ImageNet data extract.
#!/bin/bash
#
# script to extract ImageNet dataset
# ILSVRC2012_img_train.tar (about 138 GB)
# ILSVRC2012_img_val.tar (about 6.3 GB)
# make sure ILSVRC2012_img_train.tar & ILSVRC2012_img_val.tar in your current directory
#
# https://github.com/facebook/fb.resnet.torch/blob/master/INSTALL.md
#
# train/
@jeakwon
jeakwon / rebalance.py
Last active March 30, 2021 21:10
rebalance in upbit api
class UpbitAPI:
"""
:라이브러리:
import requests, jwt, uuid, hashlib, time
from urllib.parse import urlencode
:사용법:
with open(r"C:\Users\Jay\Desktop\upbit.txt", 'r') as f:
import numpy as np
t = np.arange(1000)
v = np.zeros(1000)
v[10]=1
v[200]=5
v[240]=2
def psc(t, tau1, tau2):
assert tau1<tau2
@jeakwon
jeakwon / inspect_example.py
Created August 4, 2020 13:34
inspect class args
import inspect
class foo:
def __init__(self, a, b=10, *c, **d):
values = inspect.getargvalues(inspect.currentframe())[3]
print(values)
# {'d': {}, 'c': (), 'b': 10, 'a': 1, 'self': <__main__.foo object at 0x0000021BD7DEECF8>}
@jeakwon
jeakwon / toolbar.py
Created June 27, 2020 14:35
toorbar example
import sys
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
class tooldemo(QMainWindow):
def __init__(self, parent = None):
super(tooldemo, self).__init__(parent)
layout = QVBoxLayout()
tb = self.addToolBar("File")
@jeakwon
jeakwon / dnd_mdi.py
Last active June 27, 2020 10:25
drag and drop multi document interface sample code
import os, sys
from PySide2.QtWidgets import QTextEdit, QApplication, QMainWindow, QMdiArea, QMdiSubWindow, QMessageBox
class MainWindow(QMainWindow):
def __init__(self, parent=None):
super().__init__(parent)
self.setCentralWidget(MdiArea())
class MdiArea(QMdiArea):
def __init__(self, parent=None):
@jeakwon
jeakwon / dnd_mdi.py
Created June 27, 2020 10:23
drag and drop multi document interface sample code
import os, sys
from PySide2.QtWidgets import QTextEdit, QApplication, QMainWindow, QMdiArea, QMdiSubWindow, QMessageBox
class MainWindow(QMainWindow):
def __init__(self, parent=None):
super().__init__(parent)
self.setCentralWidget(MdiArea())
class MdiArea(QMdiArea):
def __init__(self, parent=None):
@jeakwon
jeakwon / subwindow.py
Created June 26, 2020 08:12
PySide2 subwindow
from PySide2.QtWidgets import QApplication, QMainWindow, QMdiArea, QAction, QMdiSubWindow, QTextEdit
import sys
class MDIWindow(QMainWindow):
count = 0
def __init__(self):
super().__init__()
@jeakwon
jeakwon / mssql_connect.py
Created May 11, 2020 08:25
sqlalchemy, pyodbc, mssql
import pandas as pd
import pyodbc
from sqlalchemy import create_engine
engine = create_engine("mssql+pyodbc://DESKTOP-R5QA5N1/test?driver=SQL+Server+Native+Client+11.0")
df = pd.DataFrame([1])
df.to_sql('test', con=engine)
import pandas as pd
from sqlalchemy import create_engine
engine = create_engine('postgresql://id:password@localhost:port/database')
df.to_sql('table_name', engine)
pd.read_sql("select * from users limit 1", engine)