Skip to content

Instantly share code, notes, and snippets.

View havocesp's full-sized avatar

Daniel Umpierrez havocesp

  • Spain
View GitHub Profile
@havocesp
havocesp / install_codiad.sh
Created December 29, 2018 00:27 — forked from rnauber/install_codiad.sh
this installs the browser-based editor Codiad
#installs the browser-based editor Codiad
DEST=~/codiad
ADDR=127.0.0.1:9876
pkg install php
if [ ! -e $DEST ]
then
git clone https://github.com/Codiad/Codiad $DEST
import sys
import getpass
import stem.connection
import stem.socket
try:
control_socket = stem.socket.ControlPort(port = 9051)
except stem.SocketError as exc:
print 'Unable to connect to port 9051 (%s)' % exc
sys.exit(1)
@havocesp
havocesp / measure.py
Created April 3, 2019 13:48 — forked from sjtosco/measure.py
Linux Network Traffic Measure/Calculator Python Script
#!/usr/bin/env python
'''
_______ ______
|_ _\ \ / / ___|
| | \ \ / /\___ \
| | \ V / ___) |
|_| \_/ |____/
Teske Virtual System
@havocesp
havocesp / html_to_text.py
Created February 25, 2020 07:37 — forked from jspri/html_to_text.py
Converts html to plain text in python3. Only standard libraries used.
"""
HTML <-> text conversions.
http://stackoverflow.com/questions/328356/extracting-text-from-html-file-using-python
"""
from html.parser import HTMLParser
from html.entities import name2codepoint
import re
class _HTMLToText(HTMLParser):
def __init__(self):
@havocesp
havocesp / autotypedict.py
Created March 15, 2023 00:38 — forked from bhughes339/autotypedict.py
Dictionary-like class that automatically tries to typecast each scalar value to a standard type
from collections import UserDict
from collections.abc import Iterable, Mapping
import json
class AutoTypeDict(UserDict):
"""Dictionary-like class that automatically tries to typecast each
scalar value to a standard type.
Values are only typecasted when the `AutoTypeDict` instance is
updated directly, so avoid using type-specific operations on mutable