Skip to content

Instantly share code, notes, and snippets.

import re
import pyphen
NONBREAKABLE_WORDS = [ # nektera slova (napr. nazev firmy) se hodi nerozdelovat
"…",
"…"
]
def hyphens(text, lang):
"""
curl -s "https://cs.wikipedia.org/wiki/Seznam_obc%C3%AD_v_%C4%8Cesku" | pup "#content #bodyContent #mw-content-text div table tbody tr td div a" | grep -v "<" | sed "s/^ //" | sort
@helb
helb / gen.py
Created May 23, 2017 15:01
lyricsgen
import requests
from random import choice
from bs4 import BeautifulSoup
import json
import peewee
db = peewee.SqliteDatabase("lyricsgen.sqlite3")
parser = "html.parser"
@helb
helb / javascriptWorker.js
Created June 12, 2017 12:07
regex101 js worker
// this is just unminified https://regex101.com/javascriptWorker.js
! function(e) {
function t(r) {
if (n[r]) return n[r].exports;
var o = n[r] = {
i: r,
l: !1,
exports: {}
};
@helb
helb / artpip.sh
Created July 4, 2017 10:51
artpip.com daily wallpaper
#!/bin/sh
set -e;
curl http://artpip.com/api/featured |
jq ".artworks[0].url" |
xargs -n1 curl > /tmp/wall.jpg &&
feh --bg-fill /tmp/wall.jpg;
@helb
helb / beautifulsoup.md
Last active October 2, 2017 15:30
bs4 table parsing
@helb
helb / butter.py
Last active January 3, 2018 22:09
Convert cryptocurrencies to butter
#!/usr/bin/env python
from bs4 import BeautifulSoup, element
import requests
import re
from sys import argv
from decimal import Decimal
butter_url = "https://www.akcniceny.cz/zbozi/mlecne-vyrobky/masla/"
bitgup_url = "https://bitgup.com/view_currency/"
fiat_url = "https://api.fixer.io/latest?symbols=CZK&base=USD"
var str=""; document.querySelectorAll("a[href*='dl.humble.com']").forEach(link => str += (`wget "${link.href}" -O "${link.href.replace('https://dl.humble.com/', '').replace(/\?.*/, '')}"; `)); console.dir(str)
@helb
helb / SimpleHTTPServerWithUpload.py
Created March 7, 2018 08:55 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.