Skip to content

Instantly share code, notes, and snippets.

View seungwoonlee's full-sized avatar
🎯
Focusing

winCloud seungwoonlee

🎯
Focusing
View GitHub Profile
@seungwoonlee
seungwoonlee / clien.py
Created August 28, 2019 13:12 — forked from yoonbae81/clien.py
클리앙 중고장터 모니터링
#!/usr/bin/env python3
### Configuration ################################################
CLIEN_USERID = 'XXXXXXXX'
CLIEN_PASSWD = 'XXXXXXXX'
TELEGRAM_TOKEN = '000000000:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
TELEGRAM_CHAT_ID = '000000000'
### End of Configuration #########################################
import argparse
@seungwoonlee
seungwoonlee / re-test2.py
Last active April 19, 2019 10:42
한글이 포함된 날짜 문자열을 정규식만으로 변환
import re # 정규식(Regular Expression)
str = '2019-04-19 오후 1:50:39' # 2019-04-19 1:50:39 PM 로 바꾸고 싶다. dateutil.parser.parse()를 사용하기 위해서
newstr = re.sub(r"(\S+) 오후 (\S+)", r"\1 \2 PM", str) # 2019-04-19 1:50:39 PM
print(newstr)
@seungwoonlee
seungwoonlee / date-parse2.py
Created April 19, 2019 08:39
maya 를 사용해서 날짜문자열을 날짜 데이터형으로 변환
import maya # pip install maya 잘 설치가 안되는 듯, 될때까지 반복
str = '2019-04-19 1:50:39 PM'
dt = maya.parse(str).datetime()
print(dt)
print(dt.date())
print(dt.time())
print(dt.tzinfo) # 기본적으로 UTC로 설정
@seungwoonlee
seungwoonlee / date-parse1.py
Created April 19, 2019 08:30
날짜 문자열을 날짜 데이터형으로 변환
import dateutil.parser # pip install python-dateutil
str = '2019-04-19 1:50:39 PM' # 이런형태의 문자열을 날짜형으로 인식시켜야 한다
#str = '2019-04-19 오후 1:50:39' # 한글은 안되는거 같음
dt = dateutil.parser.parse(str) # 날짜로 추정되는 문자열을 datetime 데이터형으로 변환
print(type(dt)) # t 의 데이터형
print(dt)
print(dt.date())
@seungwoonlee
seungwoonlee / re-test1.py
Created April 19, 2019 08:27
한글 날짜 문자열을 dateutil.parser.parse() 에서 사용하기 위해서 간단 정규식 활용
import re # 정규식(Regular Expression)
str = '2019-04-19 오후 1:50:39' # 2019-04-19 1:50:39 PM 로 바꾸고 싶다. dateutil.parser.parse()를 사용하기 위해서
list = re.split('오후 ', str) # '오후 '를 str에서 찾아서 둘로 쪼개어 각각을 list에 넣는다. 오후 다음에 Space가 있음에 유의
print(list)
newstr = list[0] + list[1] + ' PM'
print(newstr)
@seungwoonlee
seungwoonlee / rename_file.py
Last active January 16, 2019 10:28
python file rename example
import os
def rename_movie_file(path, check_str):
for filename in os.listdir(path):
file_name, file_ext = os.path.splitext(filename)
file_ext = file_ext.lower()
if file_ext == '.md':
if check_str in filename:
file_name = file_name.replace(check_str, "")
rename_filename = file_name + file_ext
@seungwoonlee
seungwoonlee / change-ubuntu-mirror.sh
Created April 22, 2018 12:20 — forked from lesstif/change-ubuntu-mirror.sh
우분투의 apt 기본 미러를 다음 카카오로 변경
#!/bin/sh
SL=/etc/apt/sources.list
cp ${SL} ${SL}.org
##
sed -e 's/\(us.\)\?archive.ubuntu.com/ftp.daumkakao.com/g' -e 's/security.ubuntu.com/ftp.daumkakao.com/g' < ${SL}.org > ${SL}
## check
@seungwoonlee
seungwoonlee / chocolatey-env-setup.ps1
Created April 20, 2018 02:20 — forked from amogram/chocolatey-env-setup.ps1
A Chocolatey script for PowerShell I use to set up my Windows development environment. I use this when setting up my own Dev VMs. Use at your own risk.See http://bit.ly/1a301JK and http://chocolatey.org/ for more information.
# Simple environment setup script
# Install Applications
choco install fiddler4
choco install notepadplusplus
choco install visualstudiocode
choco install greenshot
choco install GoogleChrome
choco install putty
choco install ccleaner
@seungwoonlee
seungwoonlee / choco-install-package.bat
Created April 20, 2018 02:18 — forked from lesstif/choco-install-package.bat
chocolatey 로 패키지 설치
@ECHO ON
REM install choco
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
REM utility
choco install chocolatey-core.extension -y
choco install 7zip -y
choco install sysinternals -y
choco install procexp -y
@seungwoonlee
seungwoonlee / gist:5148456
Created March 13, 2013 00:43
Android Rescan Media forcibly
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));