type racer
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import requests
|
||||
|
||||
for i in range(10):
|
||||
r = requests.get('http://challenge01.root-me.org/web-serveur/ch14/')
|
||||
print(r.text)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
import requests
|
||||
|
||||
url = 'https://hookb.in/mZ16DkLRJDHeqq710qXL'
|
||||
|
||||
data = {
|
||||
"name": "John"
|
||||
}
|
||||
|
||||
r = requests.post(url, verify=False, json=data)
|
||||
@@ -0,0 +1,5 @@
|
||||
import librosa
|
||||
y, sr = librosa.load("you're a dumb mother fucker", sr=16000) # y is a numpy array of the wav file, sr = sample rate
|
||||
y_shifted = librosa.effects.pitch_shift(y, sr, n_steps=4) # shifted by 4 half steps
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import nltk
|
||||
bryant_words = nltk.corpus.gutenberg.words('bryant-stories.txt')
|
||||
print(bryant_words[:100])
|
||||
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
import numpy as np
|
||||
|
||||
k = lambda x:3*np.sin(x)*np.exp(np.sqrt(x))/(2*x)
|
||||
|
||||
def cordes_para(f,x0,epsilon,gamma,maxiter=50):
|
||||
xn = x0
|
||||
for i in range(maxiter):
|
||||
xn_ = xn
|
||||
xn = xn-f(xn)/gamma
|
||||
print(xn, f(xn))
|
||||
return (xn, np.abs(xn_-xn)<epsilon)
|
||||
|
||||
print(cordes_para(lambda x:k(x)-0.25, 3.5, 1, 5))
|
||||
@@ -0,0 +1,6 @@
|
||||
import itertools
|
||||
|
||||
print(f"always
|
||||
{'\n'.join(itertools.cycle(['more'])}
|
||||
python")
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
||||
import pyautogui
|
||||
import time
|
||||
|
||||
driver = webdriver.Chrome()
|
||||
|
||||
driver.get('https://www.keybr.com/multiplayer')
|
||||
|
||||
while True:
|
||||
ticker = driver.find_element_by_class_name('Ticker')
|
||||
if ticker.text == "GO!":
|
||||
break
|
||||
|
||||
inp = driver.find_element_by_class_name('TextInput-fragment')
|
||||
|
||||
text = driver.find_element_by_xpath("//*[@type='text']")
|
||||
print(text.send_keys('salut'))
|
||||
time.sleep(1)
|
||||
for e in inp.find_elements_by_tag_name('span'):
|
||||
print(e)
|
||||
if e.text=='␣':
|
||||
pyautogui.press(' ')
|
||||
elif e.text=='↵':
|
||||
pyautogui.press('enter')
|
||||
else:
|
||||
pyautogui.press(e.text)
|
||||
time.sleep(0.01)
|
||||
@@ -0,0 +1,56 @@
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
import time
|
||||
|
||||
url = "https://play.typeracer.com/"
|
||||
driver = webdriver.Chrome()
|
||||
driver.get(url)
|
||||
try:
|
||||
agree = driver.find_element_by_xpath("//button[text()='Agree']")
|
||||
agree.click()
|
||||
except:
|
||||
time.sleep(2)
|
||||
accept = driver.find_element_by_xpath("//button[normalize-space()='I accept']")
|
||||
accept.click()
|
||||
time.sleep(3)
|
||||
racefriends = driver.find_element_by_xpath("//a[text()='Race your friends']")
|
||||
racefriends.click()
|
||||
|
||||
time.sleep(1)
|
||||
closepopup = driver.find_element_by_xpath("//a[text()='OK']")
|
||||
closepopup.click()
|
||||
|
||||
joinracebtn = driver.find_element_by_xpath("//a[text()='join race »']")
|
||||
joinracebtn.click()
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
waiting = True
|
||||
while waiting:
|
||||
elements = driver.find_elements_by_xpath("//div[text()='Waiting for competitors...']")
|
||||
waiting = bool(elements)
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
waiting = True
|
||||
while waiting:
|
||||
countdowns = driver.find_elements_by_css_selector("body > div.countdownPopup.horizontalCountdownPopup > div > table > tbody > tr > td > table > tbody > tr > td:nth-child(1)")
|
||||
waiting = bool(countdowns)
|
||||
|
||||
time.sleep(1)
|
||||
textspans = driver.find_element_by_xpath('//*[@id="gwt-uid-17"]/table/tbody/tr[2]/td/table/tbody/tr[1]/td/table/tbody/tr[1]/td/div/div')
|
||||
|
||||
spans = textspans.find_elements_by_tag_name('span')
|
||||
spans = [span.text for span in spans]
|
||||
|
||||
print(spans)
|
||||
|
||||
text = ' '.join(spans)
|
||||
text = text.replace(' ','', 1)
|
||||
text += Keys.ENTER
|
||||
|
||||
print(text)
|
||||
|
||||
txtinput = driver.find_element_by_class_name('txtInput')
|
||||
|
||||
txtinput.send_keys(text)
|
||||
Reference in New Issue
Block a user