Skip to content

Instantly share code, notes, and snippets.

@teemuy
teemuy / fetch_html_title.py
Created October 23, 2019 18:14
Fetch HTML title given page URL, using requests and lxml
#!/usr/bin/env python
"""Fetch HTML title for URL"""
import sys
import requests
import lxml.html as html
if __name__ == '__main__':
if len(sys.argv) != 2:
print('Fetches HTML title for given URL.\n\nUsage: %s <URL>' % sys.argv[0])
### Keybase proof
I hereby claim:
* I am teemuy on github.
* I am teemuy (https://keybase.io/teemuy) on keybase.
* I have a public key ASBnoUyZZIbzlL-JwCy02QsdAiYb7kyK20WdueOl14woCgo
To claim this, I am signing this object:
@teemuy
teemuy / genrandstr.sh
Last active September 16, 2017 09:43
Shell alias to generate cryptographically strong strings for passwords/keys (needs Python2)
#
# Put the line below in your ~/.profile
# You can then say "genrandstr 10" to get a string of 10 random bytes, base64 encoded.
# Works on macOS, should work on Linux as long as there's Python 2.x installed.
#
alias genrandstr="python2 -c 'import sys,os,base64;print len(sys.argv)==2 and base64.b64encode(os.urandom(int(sys.argv[1]))) or \"Usage: genrandstr <numbytes>\"'"