# pobierz skrypt
wget https://gist.githubusercontent.com/hejmsdz/bb4acc23df5a2613bf7abc7e7753f48b/raw/hrnest.py
# opcjonalnie ustaw wirtualne środowisko
python3 -m venv .venv && . .venv/bin/activate
# zainstaluj Selenium
This file contains 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 fs from 'fs'; | |
import fetch from 'node-fetch'; | |
import { JSDOM } from 'jsdom'; | |
import YAML from 'yaml' | |
async function loadDocument(url) { | |
const response = await fetch(url); | |
const body = await response.text(); | |
const { document } = new JSDOM(body, { url }).window; | |
return document; |
This file contains 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
{ | |
"vim.vimrc.enable": true, | |
"vim.vimrc.path": "~/.config/nvim/init.vim", | |
"vim.normalModeKeyBindings": [ | |
{ | |
"before": ["<leader>", "\\"], | |
"commands": ["workbench.files.action.showActiveFileInExplorer"], | |
}, | |
{ | |
"before": ["<leader>", "1"], |
This file contains 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
#!/usr/bin/env python3 | |
import argparse | |
import base64 | |
import json | |
import hashlib | |
import os | |
import stat | |
import requests |
This file contains 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
# Simple recursive function that checks the format of a data structure, | |
# which can consist of dicts, lists, tuples and primitive types. | |
def check_format(struct, obj): | |
if isinstance(struct, dict): | |
return isinstance(obj, dict) and all(check_format(substruct, obj[key]) for key, substruct in struct.items()) | |
if isinstance(struct, tuple): | |
return isinstance(obj, tuple) and all(check_format(substruct, obj[i]) for i, substruct in enumerate(struct)) | |
elif isinstance(struct, list): | |
return isinstance(obj, list) and all(check_format(struct[0], item) for item in obj) |
This file contains 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
require "matrix" | |
class Variable | |
attr_accessor :name | |
def initialize(name) | |
@name = name | |
end | |
def to_s |
This file contains 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
require "matrix" | |
require "readline" | |
class Rational | |
# convert to integer if is actually an integer | |
def try_to_i | |
to_i == self ? to_i : self | |
end | |
end |
This file contains 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
#!/usr/bin/python | |
#-*- coding: utf-8 -*- | |
""" | |
Gra w makao | |
Mikołaj Rozwadowski, 2014 | |
Zasady: | |
- karty dokładamy tak, żeby zgadzały się kolorem lub figurą | |
- jeśli na ręce nie ma pasujących kart, bierzemy jedną z talii | |
- karty o tych samych figurach można kłaść w jednym ruchu |
This file contains 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
require 'set' | |
def ohm(value, decimals=2) | |
value.round(decimals).to_s.sub('.', ',').sub(/,0+$/, '') << " \\Omega" | |
end | |
def frac(num, den) | |
"\\frac{#{num}}{#{den}}" | |
end |
This file contains 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
(function(album) { | |
var intvl = setInterval(function() { | |
fetch('Metody_probabilistyczne_-__wiczenia_2016_17.html').then(x => x.text()).then(function(data) { | |
var dom = new DOMParser().parseFromString(data, "text/html"); | |
document.body.innerHTML = dom.getElementsByTagName('body')[0].innerHTML; | |
var tr = [].slice.call(dom.querySelectorAll('tr')).filter(tr => tr.firstChild.innerHTML == album)[0].lastChild.innerHTML; | |
if (tr != ' ') { | |
clearInterval(intvl); | |
alert(tr); | |
} else console.log('jeszcze nie ma'); |
NewerOlder