Skip to content

Instantly share code, notes, and snippets.

niyumard /
Created February 22, 2021 18:41
Gets a text file with urls and extracts info for renting houses from
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import requests
import convert_numbers
from csv import writer
URL_List_as_txt = open('url.lst', 'r')
URLs =
for URL in URLs:
niyumard /
Created September 7, 2019 15:32
This script extracts audio for French words from Linguee dictionary
import requests, sys, os
from bs4 import BeautifulSoup
r = requests.get("", data={'query': sys.argv[1]})
#print(r.status_code, r.reason)
if r.status_code == 200 and r.reason == 'OK':
niyumard /
Last active October 27, 2020 14:53
This script looks up esperanto words in website, this script is specially made for being used via GoldenDict. Usage: >python %GDWORD%
import requests,re, sys
from bs4 import BeautifulSoup
URL = ''
client = requests.session()
# Retrieve the CSRF token first
z = client.get(URL) # sets cookie
if 'YII_CSRF_TOKEN' in client.cookies and 'PHPSESSID' in client.cookies:
niyumard /
Created February 10, 2019 16:59
Draw chart for rolling dice for k times
import random
import matplotlib.pyplot as plt
#How many times do you want the loop to run?
howmanytimes = 1000000
k = 4
def dice():
r = ''
for j in range(0,k):
r += str(random.randint(1,6))