Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@norweeg
norweeg / console_logger.py
Created July 27, 2023 14:25
Setup console logging with Python standard library logging module
import logging
from sys import stderr, stdout
# Handle log messages from only these loggers.
# We will always log messages from "root" logger
# by appending names to this list, we can add additional loggers
# that should be handled
terminal_logger_names = []
# Format for terminal output: only show the log message
@norweeg
norweeg / advanced_jupyter_export.md
Created July 29, 2022 20:53
Advanced Jupyter notebook export with nbconvert

Available Formats

nbconvert can convert to the following formats:

  • HTML
  • LaTeX
  • PDF
  • webPDF (equivalent to rendering as HTML and printing to PDF)
  • Reveal.js HTML slideshow
  • ascii
@norweeg
norweeg / master-lock-crack.ipynb
Created May 9, 2022 14:01
Master Lock Crack.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@norweeg
norweeg / square-of-integers.ipynb
Created April 17, 2021 19:05
square of integers.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@norweeg
norweeg / Renderer.py
Last active October 2, 2018 13:28
A simple HTML renderer module useful for retrieving JS-rendered HTML for scraping written using PyQt5
from PyQt5 import QtCore, QtWidgets, QtWebEngineWidgets
from queue import Queue
class Renderer(QtWebEngineWidgets.QWebEnginePage):
def __init__(self,profile=None,parent=None):
super().__init__(profile,parent)
self._result_queue=Queue(maxsize=1)
self.loadFinished.connect(lambda: self.toHtml(self._result_queue.put))
def render(self,url):