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 / daemon_utils.py
Last active January 13, 2020 07:13
pil and csv image load form url, file or data
import os
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import datetime
import PIL
from PIL import Image
from exifutil import exifutil
@Jongbhin
Jongbhin / image_load.py
Last active January 30, 2020 02:52
[Image load] #python #pil #cv2
#!/usr/bin/env python3
import pyvips
import cv2
from PIL import Image
import timeit
import numpy as np
import time
import cProfile
@Jongbhin
Jongbhin / get_score_handler_v2.py
Last active January 30, 2020 04:42
[get_score_handler_v2] #python #handler #pytorch
class GetScoreHandler_v2(BaseHandler):
def __init__(self, *args, **kwargs):
super(GetScoreHandler_v2, self).__init__(*args, **kwargs)
self.model = CleanscoringModelV2API()
@gen.coroutine
def post(self, slug=None):
try:
request_json_data = json.loads(self.request.body)
@Jongbhin
Jongbhin / crontab_list.md
Created January 30, 2020 09:50
[crontab backup]

crontab backup

00 00 * * * crontab -l &> /app/puser/crontab_list ~

Category Mapping

  • CTGRYi-11stbat02 : 172.21.16.82 v
  • IMGPRCSb-ctgr01 : 172.28.4.65 v
  • IMGPRCSb-ctgr02 : 172.28.4.66 v
  • IMGPRCSb-ctgr03 : 172.28.4.67

Clean Scoring

@Jongbhin
Jongbhin / tsv_to_csv.py
Created February 7, 2020 05:40
[tsv to csv] #tsv #csv
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import csv
output_dir = ''
input_file = os.path.join(output_dir, 'input0000')
output_file = os.path.join(output_dir, 'input0000.tsv')
@Jongbhin
Jongbhin / ssh_key_gen.md
Last active February 7, 2020 06:47
[ssh key gen] #ssh

generate rsa key

ssh-keygen

add to server

ssh-copy-id -i ~/.ssh/id_rsa.pub 1100378@host
@Jongbhin
Jongbhin / make_dey_dict.py
Created February 10, 2020 06:37
[make dict for key value] #dict, #python, #pickle
with open(input_file) as ifd:
csv_reader = csv.reader(ifd, delimiter='\t', quoting=csv.QUOTE_NONE)
token_dict = {}
for counter, row in enumerate(csv_reader):
prd_no = row[0]
token_dict[prd_no] = row[1:]
with open(output_file, mode='w') as wfd:
pickle.dump(token_dict, wfd, protocol=pickle.HIGHEST_PROTOCOL)
@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')
@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 / 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)