773 Matching Annotations
  1. May 2019
  2. Apr 2019
    1. #!/usr/bin/env python3 import configparser import os import sys from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By config = configparser.ConfigParser() config.read("config.ini") chrome_options = Options() chrome_options.add_argument("--headless") driver = webdriver.Chrome(executable_path=os.path.abspath("/usr/local/bin/chromedriver"), chrome_options=chrome_options) driver.get("https://fastmail.fm") timeout = 120 try: element_present = EC.presence_of_element_located((By.NAME, 'username')) WebDriverWait(driver, timeout).until(element_present) # Send login information user = driver.find_element_by_name("username") passwd = driver.find_element_by_name("password") user.send_keys(config["default"]["user"]) passwd.send_keys(config["default"]["pass"]) driver.find_element_by_class_name("v-Button").click() print("Logged in") # wait for login to complete element_present = EC.presence_of_element_located((By.CLASS_NAME, 'v-MainNavToolbar')) WebDriverWait(driver, timeout).until(element_present) # click settings menu to make elements visible driver.find_element_by_class_name("v-MainNavToolbar").click() # And follow to settings page driver.find_element_by_link_text("Settings").click() # Wait for settings page to render, oh Javascript element_present = EC.presence_of_element_located((By.LINK_TEXT, 'Rules')) WebDriverWait(driver, timeout).until(element_present) # Click on Rules link driver.find_element_by_link_text("Rules").click() # Click on edit custom sieve code element_present = EC.presence_of_element_located((By.LINK_TEXT, 'Edit custom sieve code')) WebDriverWait(driver, timeout).until(element_present) driver.find_element_by_link_text("Edit custom sieve code").click() print("Editing") # This is super unstable, I hate that we have to go by webid element_present = EC.presence_of_element_located((By.CLASS_NAME, 'v-EditSieve-rules')) WebDriverWait(driver, timeout).until(element_present) print("Find form") elements = driver.find_elements_by_css_selector("textarea.v-Text-input") element = elements[-1] # Find the submit button elements = driver.find_elements_by_css_selector("button") for e in elements: if "Save" in e.text: submit = e print("Found form") # And replace the contents element.clear() with open("rules.txt") as f: element.send_keys(f.read()) # This is the Save button print("Submitted!") submit.click() except TimeoutException as e: print(e) print("Timed out waiting for page to load") sys.exit(0) print("Done!")
  3. Mar 2019
    1. pi = 3.1415 ... e = 2.718 ... Euler's constant, gamma = 0.577215 ... = lim n -> infinity > (1 + 1/2 + 1/3 + 1/4 + ... + 1/n - ln(n)) (Not proven to be transcendental, but generally believed to be by mathematicians.) Catalan's constant, G = sum (-1)^k / (2k + 1 )^2 = 1 - 1/9 + 1/25 - 1/49 + ... (Not proven to be transcendental, but generally believed to be by mathematicians.) Liouville's number 0.110001000000000000000001000 ... which has a one in the 1st, 2nd, 6th, 24th, etc. places and zeros elsewhere. Chaitin's "constant", the probability that a random algorithm halts. (Noam Elkies of Harvard notes that not only is this number transcendental but it is also incomputable.) Chapernowne's number, 0.12345678910111213141516171819202122232425... This is constructed by concatenating the digits of the positive integers. (Can you see the pattern?) Special values of the zeta function, such as zeta (3). (Transcendental functions can usually be expected to give transcendental results at rational points.) ln(2). Hilbert's number, 2(sqrt 2 ). (This is called Hilbert's number because the proof of whether or not it is transcendental was one of Hilbert's famous problems. In fact, according to the Gelfond-Schneider theorem, any number of the form ab is transcendental where a and b are algebraic (a ne 0, a ne 1 ) and b is not a rational number. Many trigonometric or hyperbolic functions of non-zero algebraic numbers are transcendental.) epi pie (Not proven to be transcendental, but generally believed to be by mathematicians.) Morse-Thue's number, 0.01101001 ... ii = 0.207879576... (Here i is the imaginary number sqrt(-1). Isn't this a real beauty? How many people have actually considered rasing i to the i power? If a is algebraic and b is algebraic but irrational then ab is transcendental. Since i is algebraic but irrational, the theorem applies. Note also: ii is equal to e(- pi / 2 ) and several other values. Consider ii = e(i log i ) = e( i times i pi / 2 ) . Since log is multivalued, there are other possible values for ii. Here is how you can compute the value of ii = 0.207879576... 1. Since e^(ix) = Cos x + i Sin x, then let x = Pi/2. 2. Then e^(iPi/2) = i = Cos Pi/2 + i Sin Pi/2; since Cos Pi/2 = Cos 90 deg. = 0. But Sin 90 = 1 and i Sin 90 deg. = (i)*(1) = i. 3. Therefore e^(iPi/2) = i. 4. Take the ith power of both sides, the right side being i^i and the left side = [e^(iPi/2)]^i = e^(-Pi/2). 5. Therefore i^i = e^(-Pi/2) = .207879576... Feigenbaum numbers, e.g. 4.669 ... . (These are related to properties of dynamical systems with period-doubling. The ratio of successive differences between period-doubling bifurcation parameters approaches the number 4.669 ... , and it has been discovered in many physical systems before they enter the chaotic regime. It has not been proven to be transcendental, but is generally believed to be.)
  4. Feb 2019
  5. Jan 2019
  6. Dec 2018
    1. The syntax for using git checkout to update the working tree with files from a tree-ish is as follows: git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>… Therefore, to update the working tree with files or directories from another branch, you can use the branch name pointer in the git checkout command. git checkout <branch_name> -- <paths> As an example, this is how you could update your gh-pages branch on GitHub (used to generate a static site for your project) to include the latest changes made to a file that is on the master branch. # On branch master git checkout gh-pages git checkout master -- myplugin.js git commit -m "Update myplugin.js from master"
  7. Nov 2018
  8. Oct 2018
  9. generations.fr genera