[์ •๋ณด] JavaScript์—์„œ HTTP ์š”์ฒญ์„ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
JavaScript์—์„œ HTTP ์š”์ฒญ์„ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ๋Š” ๋‚ด์žฅ๋œ fetch() ํ•จ์ˆ˜๋‚˜ XMLHttpRequest (XHR) ๊ฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ์€ fetch()์„ ์‚ฌ์šฉํ•˜๋Š” ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค: fetch('https://example.com/data') .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error(error)); ์ด ์˜ˆ์‹œ์—์„œ๋Š” https://example.com/data๋กœ GET ์š”์ฒญ์„ ๋ณด๋‚ด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. fetch() ํ•จ์ˆ˜๋Š” ์š”์ฒญ์— ๋Œ€ํ•œ ์„œ๋ฒ„์˜ ์‘๋‹ต์„ ๋‚˜ํƒ€๋‚ด๋Š” Response ๊ฐ์ฒด๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” Promise๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ ๋‹ค์Œ, Response ๊ฐ์ฒด์—์„œ json() ๋ฉ”..
[์ •๋ณด] ์  ํ‚จ์Šค ํ™œ์šฉ ๋ฐฉ๋ฒ•
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
CI/CD(Continuous Integration/Continuous Deployment)๋Š” ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ๊ฐœ๋ฐœํ•˜๊ณ  ๋ฐฐํฌํ•˜๋Š” ๋ฐ ์žˆ์–ด์„œ ์ง€์†์ ์ธ ํ†ตํ•ฉ ๋ฐ ๋ฐฐํฌ๋ฅผ ์ˆ˜ํ–‰ํ•˜๋Š” ๋ฐฉ๋ฒ•๋ก ์ž…๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด์„œ ์  ํ‚จ์Šค(Jenkins)๋Š” ๋งŽ์ด ํ™œ์šฉ๋˜๋Š” ์˜คํ”ˆ ์†Œ์Šค ๋„๊ตฌ ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค. ์  ํ‚จ์Šค๋ฅผ ํ™œ์šฉํ•˜์—ฌ CI/CD ํŒŒ์ดํ”„๋ผ์ธ์„ ๊ตฌ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์  ํ‚จ์Šค ์„ค์น˜ ๋ฐ ์„ค์ •: ์  ํ‚จ์Šค ์›น ์‚ฌ์ดํŠธ์—์„œ ๋‹ค์šด๋กœ๋“œ ๋ฐ›์•„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. ์„ค์น˜ ํ›„, ์  ํ‚จ์Šค ์„œ๋ฒ„๋ฅผ ์‹œ์ž‘ํ•˜๊ณ , ๊ด€๋ฆฌ์ž ๊ณ„์ •์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ์†Œ์Šค ์ฝ”๋“œ ์ €์žฅ์†Œ์™€ ์—ฐ๊ฒฐ: CI/CD๋ฅผ ์œ„ํ•ด์„œ๋Š” ์†Œ์Šค ์ฝ”๋“œ๋ฅผ ์ €์žฅํ•˜๊ณ  ์žˆ๋Š” ์ €์žฅ์†Œ(Git, SVN ๋“ฑ)์™€ ์—ฐ๊ฒฐํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด, ์  ํ‚จ์Šค์—์„œ "์ €์žฅ์†Œ ๊ด€๋ฆฌ" ๋ฉ”๋‰ด๋ฅผ ์ด์šฉํ•˜์—ฌ ์†Œ์Šค ์ฝ”๋“œ ์ €์žฅ์†Œ์™€์˜ ์—ฐ๊ฒฐ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ๋นŒ๋“œ ํ™˜๊ฒฝ ์„ค์ •..
[์ •๋ณด] ํŒŒ์ด์ฌ ํŒŒ์ผ ์ธ์ฝ”๋”ฉ ๋ณ€ํ™˜ ํ•จ์ˆ˜
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
ํŒŒ์ด์ฌ์—์„œ ํŒŒ์ผ ์ธ์ฝ”๋”ฉ์„ ๋ณ€ํ™˜ํ•˜๊ธฐ ์œ„ํ•ด codecs ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜๋Š” codecs ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•˜์—ฌ ํŒŒ์ผ์˜ ์ธ์ฝ”๋”ฉ์„ ๋ณ€ํ™˜ํ•˜๋Š” ์˜ˆ์‹œ ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค. import codecs def convert_encoding(file_path, from_encoding, to_encoding): with codecs.open(file_path, 'r', from_encoding) as file: content = file.read() with codecs.open(file_path, 'w', to_encoding) as file: file.write(content) ์œ„์˜ convert_encoding ํ•จ์ˆ˜๋Š” ์„ธ ๊ฐœ์˜ ์ธ์ž๋ฅผ ๋ฐ›์Šต๋‹ˆ๋‹ค: file_path: ์ธ์ฝ”๋”ฉ์„ ๋ณ€ํ™˜ํ•˜๊ณ ์ž ํ•˜๋Š” ํŒŒ์ผ ๊ฒฝ๋กœ์ž…๋‹ˆ๋‹ค. from_e..
[ํŒŒ์ด์ฌ] ์†Œ์ผ“ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์˜ˆ์ œ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
์„œ๋ฒ„ ์ธก ์ฝ”๋“œ: import socket HOST = '127.0.0.1' PORT = 65432 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.bind((HOST, PORT)) s.listen() conn, addr = s.accept() with conn: print('Connected by', addr) while True: data = conn.recv(1024) if not data: break conn.sendall(data) ํด๋ผ์ด์–ธํŠธ ์ธก ์ฝ”๋“œ: import socket HOST = '127.0.0.1' PORT = 65432 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) a..
[ํŒŒ์ด์ฌ] cmd ๋ช…๋ น ์ œ์–ด ๊ณ„์† ๋ฐ›๊ธฐ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
https://docs.python.org/ko/3/library/cmd.html cmd — ์ค„ ์ง€ํ–ฅ ๋ช…๋ น ์ธํ„ฐํ”„๋ฆฌํ„ฐ ์ง€์› — Python 3.10.5 ๋ฌธ์„œ cmd — ์ค„ ์ง€ํ–ฅ ๋ช…๋ น ์ธํ„ฐํ”„๋ฆฌํ„ฐ ์ง€์› ์†Œ์Šค ์ฝ”๋“œ: Lib/cmd.py Cmd ํด๋ž˜์Šค๋Š” ์ค„ ์ง€ํ–ฅ ๋ช…๋ น ์ธํ„ฐํ”„๋ฆฌํ„ฐ๋ฅผ ์ž‘์„ฑํ•˜๊ธฐ ์œ„ํ•œ ๊ฐ„๋‹จํ•œ ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ๋“ค์€ ์ข…์ข… ํ…Œ์ŠคํŠธ ํ•˜๋„ค์Šค(test harnesses), ๊ด€ docs.python.org
[ํŒŒ์ด์ฌ] subprocess ์ˆ˜ํ–‰ ๋Œ€๊ธฐ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
main์—์„œ subprocess.Popen์œผ๋กœ ์ž์‹ํ”„๋กœ์„ธ์Šค ์ƒ์„ฑํ›„ communicate ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด ์ž์‹ํ”„๋กœ์„ธ์Šค๊ฐ€ ์™„๋ฃŒ๋ ๋•Œ ๋‹ค์Œ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•œ๋‹ค ''' 1 ''' proc = subprocess.Popen('ls') proc.communicate() ''' 3 '''
[ํŒŒ์ด์ฌ] ์ปดํ“จํ„ฐ ์‹œ์ž‘ ํ”„๋กœ๊ทธ๋žจ ๋“ฑ๋ก ๋ฐฉ๋ฒ•
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
1. ์„œ๋น„์Šค ๋“ฑ๋ก 2. ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ๋“ฑ๋ก [ ์‚ฌ์šฉ์ž ๊ณ„์ • ] ์ง€์†์šฉ : HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run ์ผํšŒ์šฉ : HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce [ ์ „์ฒด ์‚ฌ์šฉ์ž ] ์ง€์†์šฉ : HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run ์ผํšŒ์šฉ : HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce 3. ์‹œ์ž‘ ํ”„๋กœ๊ทธ๋žจ ํด๋” ๋“ฑ๋ก [ ์‚ฌ์šฉ์ž ๊ณ„์ • ] %APPDATA%\Microsoft\Windows\Start Me..
[ํŒŒ์ด์ฌ] win32com ์ž‘์—… ์Šค์ผ€์ค„๋Ÿฌ ์ฝ”๋“œ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
# Uses the COM Task Scheduler Interface to create a task # scheduled to execute when the current user logs on. import win32com.client import os computer_name = "" #leave all blank for current computer, current user computer_username = "" computer_userdomain = "" computer_password = "" action_id = "Test Task" #arbitrary action ID action_path = r"c:\windows\system32\calc.exe" #executable path (cou..
[ํŒŒ์ด์ฌ] ์ž‘์—… ์Šค์ผ€์ค„๋Ÿฌ ๋“ฑ๋ก ํŒŒ์ด์ฌ ์ฝ”๋“œ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
์‘์šฉ ํ”„๋กœ๊ทธ๋žจProgID Microsoft Access Access.Application Microsoft Excel Excel.Application Microsoft Outlook Outlook.Application Microsoft PowerPoint Powerpoint.Application Microsoft Word Word.Application Microsoft FrontPage FrontPage.Application import datetime import win32com.client scheduler = win32com.client.Dispatch('Schedule.Service') scheduler.Connect() root_folder = scheduler.GetFolder('\\') ta..
[ํŒŒ์ด์ฌ] ๋ฐฐํฌ ์ž๋™ํ™” ์ฐธ๊ณ  ์ฝ”๋“œ
ยท
๐Ÿžํ”„๋กœ๊ทธ๋ž˜๋ฐ
https://sucrearn.tistory.com/3 Pyinstaller๋กœ ๋งŒ๋“  ํ”„๋กœ๊ทธ๋žจ ์ž๋™ ์—…๋ฐ์ดํŠธ ์ ์šฉ๊ธฐ ์ตœ๊ทผ ํšŒ์‚ฌ์—์„œ ํŒŒ์ด์ฌ์„ ์ด์šฉํ•œ ์†”๋ฃจ์…˜ ๊ฐœ๋ฐœ์„ ์‹œ์ž‘ํ•˜๊ฒŒ ๋๋‹ค. ํ•ด๋‹น ์†”๋ฃจ์…˜ ๊ฐœ๋ฐœ์— ๋ช‡๊ฐ€์ง€ ์กฐ๊ฑด์ด ์žˆ์—ˆ๋Š”๋ฐ, ํฌ๊ฒŒ ๋‹ค์Œ ๋‘๊ฐ€์ง€๊ฐ€ ๊ฐ€์žฅ ์ค‘์š”ํ–ˆ๋‹ค. ํŒŒ์ด์ฌ์œผ๋กœ ๊ฐœ๋ฐœํ•˜๊ณ , ๋…๋ฆฝ์‹คํ–‰์ด ๊ฐ€๋Šฅํ•  ๊ฒƒ ์—ฌ sucrearn.tistory.com