Skip to content

Instantly share code, notes, and snippets.

View Jongbhin's full-sized avatar

Jongbhin Park Jongbhin

  • SK Planet
  • Pangyo
View GitHub Profile
@Jongbhin
Jongbhin / pil_plugin.py
Last active April 9, 2020 12:21
[PIL to scikit-image] #pil #scikit-image
__all__ = ['imread', 'imsave']
from distutils.version import LooseVersion
import warnings
import numpy as np
from PIL import Image, __version__ as pil_version
from ...util import img_as_ubyte, img_as_uint
@Jongbhin
Jongbhin / linux_command_reference.md
Last active July 25, 2022 07:42
[linux command reference] #linux #command #reference

Linux netstat command find out which process is listing upon a port

Find out the process that opened thr port

netstat -tulpn
ls -l /proc/1138/exe

Find out the processes PID that opened tcp port 7000, enter:

fuser 7000/tcp
@Jongbhin
Jongbhin / haproxy.md
Last active April 1, 2020 09:39
[HAProxy] #haproxy

Install

sudo apt show haproxy
sudo apt install -y haproxy

Commands

systemctl restart haproxy

Configuration

@Jongbhin
Jongbhin / bash_reference.md
Last active March 30, 2022 02:31
[bash reference] #bash #reference
@Jongbhin
Jongbhin / git_reference.md
Last active August 8, 2023 06:38
[Git reference] #git #reference

Git add remote

git remote add REMOTE-ID REMOTE-URL
git remote set-url --add --push all REMOTE-URL-1
git remote set-url --add --push all REMOTE-URL-2
# git remote set-url --add --push all git@175.126.56.233:CVPR/clean-scoring-v2-api.git

Git fetch all branches

@Jongbhin
Jongbhin / split_train_dev.py
Last active March 24, 2020 01:34
[Split train dev file] #python # ml #dl
import pandas as pd
from sklearn.model_selection import train_test_split
# split train, dev set and save to file
all_data = pd.read_csv(output_file_balanced, sep='\t')
all_data.sample(frac=1)
train_set, dev_set = train_test_split(all_data, test_size=0.2)
train_set.to_csv(output_file_train, sep='\t', header=False, index=False)
dev_set.to_csv(output_file_dev, sep='\t', header=False, index=False)
@Jongbhin
Jongbhin / transformers.md
Last active March 24, 2020 04:39
[Transformers tip] #transformer #bert
ImportError: cannot import name 'WarmupLinearSchedule'
https://github.com/huggingface/transformers/issues/2082
  • 2.1.1을 체크아웃하고 사용하면 해결됨
@Jongbhin
Jongbhin / purify.py
Last active March 12, 2020 00:34
[image purify] #image # 11st #url #purify
import csv
import gzip
import os
file_name = 'input0000'
out_file_name = 'input0000.fix'
if os.path.exists(out_file_name):
os.remove(out_file_name)
@Jongbhin
Jongbhin / python_api_test.py
Created March 2, 2020 07:30
[python api test] #python #api #test
import unittest
import os, sys, time
import json
from subprocess import call
import requests
import csv
parentPath = os.path.abspath("../..")
if parentPath not in sys.path:
sys.path.insert(0, parentPath)
@Jongbhin
Jongbhin / python_reference.md
Created March 2, 2020 00:08
python reference

String

get extension

filename, file_extension = os.path.splitext('/path/to/somefile.ext')