Skip to content

Instantly share code, notes, and snippets.

@fecub
fecub / beatifulsoup_replacements.py
Created April 15, 2021 17:19 — forked from cbcafiero/replacements.py
Easy multiple search and replace by tag and attribute with BeautifulSoup
"""
Sometimes you want to make several different replacements. Search by tag with
optional attributes. Replace with tag with optional attributes.
Thank you to Dan @ University of Exeter for bug fix
"""
from bs4 import BeautifulSoup
REPLACEMENTS = [('b', {}, 'strong', {}),
@fecub
fecub / bluetoothctl.py
Created January 7, 2018 00:19 — forked from egorf/bluetoothctl.py
Bluetoothctl wrapper in Python
# ReachView code is placed under the GPL license.
# Written by Egor Fedorov (egor.fedorov@emlid.com)
# Copyright (c) 2015, Emlid Limited
# All rights reserved.
# If you are interested in using ReachView code as a part of a
# closed source project, please contact Emlid Limited (info@emlid.com).
# This file is part of ReachView.
@fecub
fecub / woof.py
Created November 30, 2017 23:33 — forked from robcowie/woof.py
woof.py One-time file server
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# woof -- an ad-hoc single file webserver
# Copyright (C) 2004-2009 Simon Budig <simon@budig.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
@fecub
fecub / fontdemo.py
Created November 30, 2017 23:32 — forked from dbader/fontdemo.py
For my Raspberry Pi internet radio project I needed a way to render text suitable for a low resolution monochrome LCD. This article describes how to render 1-bit text using FreeType and Python. See http://dbader.org/blog/monochrome-font-rendering-with-freetype-and-python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Needs freetype-py>=1.0
# For more info see:
# http://dbader.org/blog/monochrome-font-rendering-with-freetype-and-python
# The MIT License (MIT)
#
# Copyright (c) 2013 Daniel Bader (http://dbader.org)
/*
Copyright (c) 2014 Cutehacks A/S
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@fecub
fecub / calc.kv
Created November 4, 2013 14:04 — forked from tshirtman/calc.kv
BoxLayout:
orientation: 'vertical'
Label:
size_hint_y: None
height: '50dp'
id: calc
text: ''
GridLayout:
cols: 4