๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
  • Tried. Failed. Logged.
728x90

๐Ÿ‘จ๐Ÿผ‍๐Ÿ’ป๊ฐœ๋ฐœ158

์…€๋ ˆ๋‹ˆ์›€ - ์ด๋ฏธ์ง€(img) ๋‹ค์šด๋กœ๋“œ (No urllib.urlretrieve) URL ์š”์ฒญ ๋ฐฉ์‹์ธ urllib.urlretrieve์€ src ์ฃผ์†Œ๋กœ ์š”์ฒญ์„ ํ•˜๋Š” ๋ฐฉ์‹์ด๊ธฐ ๋•Œ๋ฌธ์— ์บก์ฑ (์ž๋™๋“ฑ๋ก๋ฐฉ์ง€ ๋ฌธ์ž)์ฒ˜๋Ÿผ ๋งค๋ฒˆ ์š”์ฒญํ•  ๋•Œ๋งˆ๋‹ค ์ด๋ฏธ์ง€๊ฐ€ ๋ฐ”๋€Œ๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์–ด ๋ฌด์šฉ์ง€๋ฌผ์ด ๋œ๋‹ค. ๊ทธ๋Ÿฌ๋ฏ€๋กœ ์ด๋ฏธ ๋ธŒ๋ผ์šฐ์ €์— ๋กœ๋“œ๊ฐ€ ๋œ ์ด๋ฏธ์ง€๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค. ๋ฐฉ๋ฒ• 1. screenshot_as_png ์‚ฌ์šฉ (์ถ”์ฒœ) from selenium import webdriver driver = webdriver.Firefox() driver.get('https://www.webpagetest.org/') with open('filename.png', 'wb') as file: file.write(driver.find_element_by_xpath('/html/body/div[1]/div[5]/div[2.. 2023. 2. 28.
ํŒŒ์ด์ฌ - ์„ธ์…˜ ๋งŒ๋ฃŒ ์‹œ๊ฐ„ ๊ฒ€์ฆํ•˜๊ธฐ from datetime import timedelta, datetime session_lifetime = timedelta(seconds=10) # ์„ธ์…˜ ์œ ์ง€ ์‹œ๊ฐ„ expired_time = datetime.now() + session_lifetime if expired_time < datetime.now(): print("์„ธ์…˜ ์‚ฌ์šฉ ๊ธฐ๊ฐ„์ด ๋งŒ๋ฃŒ๋จ.") 2023. 2. 3.
ํŒŒ์ด์ฌ - ํ—ˆ์šฉ๋œ ๋ฌธ์ž, ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ฌธ์ž๋“ค์ธ์ง€ ๊ฒ€์ฆํ•˜๊ธฐ (re) ์˜๋ฌธ, ์ˆซ์ž, ํŠน์ˆ˜ ๋ฌธ์ž๋“ค๋กœ ๊ตฌ์„ฑ๋œ ๋น„๋ฐ€๋ฒˆํ˜ธ์ธ์ง€ ํ™•์ธํ•˜๊ธฐ import re password = raw_input("Enter string to test: ") if re.fullmatch(r'[A-Za-z0-9!@#$%^&+=]{8,}', password): # match else: # no match ์ถœ์ฒ˜: https://stackoverflow.com/questions/2990654/how-to-test-a-regex-password-in-python How to test a regex password in Python? Using a regex in Python, how can I verify that a user's password is: At least 8 characters Must be re.. 2023. 2. 3.
Flask - ํŒŒ์ด์ฌ flask ๊ฐ„๋‹จํ•œ ์บก์ฑ  ์˜ˆ์ œ(flask-simple-captcha) ๋ชจ๋“ˆ ์„ค์น˜ pip install flask-simple-captcha simple_captcha_example.py from flask import Flask, render_template, request from flask_simple_captcha import CAPTCHA config = { 'SECRET_CAPTCHA_KEY': '1111111111111111111111111', 'METHOD': 'pbkdf2:sha256:100', 'CAPTCHA_LENGTH': 5, 'CAPTCHA_DIGITS': False } @app.route('/example', methods=['GET','POST']) def example(): if request.method == 'GET': captcha = CA.. 2023. 2. 2.
C# - ์„ค์ • ๊ฐ’ ๋ฐฐ์—ด(array) ํ˜•ํƒœ๋กœ ์ €์žฅํ•˜๊ณ  ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์ €์žฅํ•˜๊ธฐ string value = String.Join(",", intArray.Select(i => i.ToString()).ToArray()); Properties.Settings.Default.option_array = value; Properties.Settings.Default.Save(); ๋ถˆ๋Ÿฌ์˜ค๊ธฐ int[] arr = Properties.Settings.Default.option_array.Split(',').Select(s => Int32.Parse(s)).ToArray(); ์ถœ์ฒ˜: https://stackoverflow.com/questions/1766610/how-to-store-int-array-in-application-settings How to store int[] array .. 2023. 2. 1.
C# - dataGridView1 ์…€ ๊ฐ’ ์ˆ˜์ •ํ•˜๊ธฐ dataGridView1[1,1].Value="tes"; ์ถœ์ฒ˜: https://stackoverflow.com/questions/1516252/how-to-programmatically-set-cell-value-in-datagridview How to programmatically set cell value in DataGridView? I have a DataGridView. Some of the cells receive their data from a serial port: I want to shove the data into the cell, and have it update the underlying bound object. I'm trying something like th... stackov.. 2023. 2. 1.
์…€๋ ˆ๋‹ˆ์›€ - ํŒŒ์ด์ฌ ๋ด‡ ๊ฐ์ง€ ์šฐํšŒ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ(undetected-chromdriver) pypi https://pypi.org/project/undetected-chromedriver/ undetected-chromedriver ('Selenium.webdriver.Chrome replacement with compatiblity for Brave, and other Chromium based browsers.', 'Not triggered by CloudFlare/Imperva/hCaptcha and such.', 'NOTE: results may vary due to many factors. No guarantees are given, except for ongoing eff pypi.org ์„ค์น˜ pip install undetected-chromedriver ์‚ฌ์šฉ ์˜ˆ์‹œ import u.. 2023. 1. 29.
C# - ๋งˆ์ดํฌ๋กœ์†Œํ”„ํŠธ ๊ณต์‹ UWP, WPF ์ž์Šต์„œ (GUI ํ”„๋กœ๊ทธ๋ž˜๋ฐ) ๋ฐ ๋‘˜์˜ ์ฐจ์ด์  UWP ์ž์Šต์„œ https://learn.microsoft.com/ko-kr/visualstudio/get-started/csharp/tutorial-uwp?view=vs-2022 ์ž์Šต์„œ: Visual Studio ๋ฐ C#์„ ์‚ฌ์šฉํ•˜์—ฌ UWP ์•ฑ ๋งŒ๋“ค๊ธฐ Visual Studio์—์„œ XAML ๋ฐ C#์„ ์‚ฌ์šฉํ•˜์—ฌ UWP ์•ฑ ๋งŒ๋“ค๊ธฐ learn.microsoft.com WPF ์ž์Šต์„œ https://learn.microsoft.com/ko-kr/visualstudio/get-started/csharp/tutorial-wpf?view=vs-2022 C#์—์„œ WPF๋ฅผ ์‚ฌ์šฉํ•˜๋Š” Hello World ์•ฑ - Visual Studio (Windows) WPF(Windows Presentation Foundation) UI ํ”„.. 2023. 1. 19.
OpenCV - ํŒŒ์ด์ฌ cv2 ์ด๋ฏธ์ง€ ์†์— ํŠน์ • ์ด๋ฏธ์ง€ ๊ฐ์ง€ํ•˜๊ธฐ def isExistImage(a, b, c=0.65): print("์ด๋ฏธ์ง€ ์กด์žฌ ์—ฌ๋ถ€") img_rgb = cv2.imread(a) template = cv2.imread(b) h, w = template.shape[:-1] res = cv2.matchTemplate(img_rgb, template, cv2.TM_CCOEFF_NORMED) threshold = c loc = np.where(res >= threshold) return len( loc[0] ) != 0 print(isExistImage("screen.png", "target.png")) # True or False def getMatchPosition(a, b, c=0.65): print("์ด๋ฏธ์ง€ ์œ„์น˜ ๊ฐ€์ ธ์˜ค๊ธฐ") img_rgb = cv.. 2023. 1. 16.
์…€๋ ˆ๋‹ˆ์›€ - ๋ธŒ๋ผ์šฐ์ € ์ฐฝ ์œ„์น˜ ์•ˆ๋ณด์ด๋Š” ๊ณณ์œผ๋กœ ์ด๋™ var options = new ChromeOptions(); options.AddArgument("--window-position=-32000,-32000"); var chromeDriverService = ChromeDriverService.CreateDefaultService(); chromeDriverService.HideCommandPromptWindow = true; driver = new ChromeDriver(chromeDriverService, options); 2022. 12. 19.
์…€๋ ˆ๋‹ˆ์›€ - ํฌ๋กœ๋ฏธ์›€ ์˜›๋‚  ๋ฒ„์ „๋“ค ๋‹ค์šด๋กœ๋“œ https://vikyd.github.io/download-chromium-history-version/#/ Chromium History Versions Download ↓ vikyd.github.io 2022. 12. 7.
์…€๋ ˆ๋‹ˆ์›€ - alert, confirm ์™„์ „ ์ฐจ๋‹จ ํ™•์žฅ ๋„๊ตฌ https://chrome.google.com/webstore/detail/alert-control/ofjjanaennfbgpccfpbghnmblpdblbef Alert Control Control browser alert windows. Block by default or on specific websites. chrome.google.com ๊ฐ€๋” alert์ด ๋œจ๋ฉด ์…€๋ ˆ๋‹ˆ์›€์ด ์•„์˜ˆ ์กฐ์ž‘์ด ์•ˆ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋Š”๋ฐ, ์ด ํ™•์žฅ ๋„๊ตฌ๋ฅผ ์„ค์น˜ํ•ด์ฃผ๋ฉด alert์ด ์•„์˜ˆ ๋‚˜์˜ค์ง€ ์•Š๋Š”๋‹ค. 2022. 11. 30.
728x90