Skip to content

Instantly share code, notes, and snippets.

@apollo13
apollo13 / chromelogger.py
Last active May 12, 2022 01:09
Django logging to Firefox/Chrome devtools
"""
License: MIT - https://opensource.org/licenses/MIT
ChromeLogger is a protocol which allows sending logging messages to the Browser.
This module implements simple support for Django. It consists of two components:
* `LoggingMiddleware` which is responsible for sending all log messages
associated with the request to the browser.
* `ChromeLoggerHandler` a python logging handler which collects all messages.
"""
Formatting based on:
https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Albums/Album_article_style_guide
Method inspired from:
- https://github.com/plamere/spotipy/blob/master/examples/user_playlists_contents.py
- https://github.com/jacobian/rdio-takeout-importer/blob/master/r2s.py#L68
Getting started:
import click
import json
from livescrape import ScrapedPage, Css, CssLink, CssMulti
class TeamRosterPage(ScrapedPage):
scrape_url = 'http://stats.ncaa.org/team/roster/%(season_id)s?org_id=%(team_id)s'
scrape_args = ('season_id', 'team_id')
table_contents = CssMulti(
@hfreire
hfreire / qemu_osx_rpi_raspbian_jessie.sh
Last active March 24, 2024 14:35
How to emulate a Raspberry Pi (Raspbian Jessie) on Mac OSX (El Capitan)
# Install QEMU OSX port with ARM support
sudo port install qemu +target_arm
export QEMU=$(which qemu-system-arm)
# Dowload kernel and export location
curl -OL \
https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-4.1.7-jessie
export RPI_KERNEL=./kernel-qemu-4.1.7-jessie
# Download filesystem and export location
@wkjagt
wkjagt / audio-book-reader.md
Last active April 12, 2024 14:18
How I built an audio book reader for my nearly blind grandfather

#How I built an audio book reader for my nearly blind grandfather

Tweet this - Follow me

Last year, when visiting my family back home in Holland, I also stopped by my grand-parents. My grand-father, now 93 years old, had always been a very active man. However, during the presceding couple of months, he'd gone almost completely blind and now spent his days sitting in a chair. Trying to think of something for him to do, I suggested he try out audio books. After finally convincing him -- he said audio books were for sad old people -- that listening to a well performed recording is actually a wonderful experience, I realized the problem of this idea.

####The problem with audio devices and the newly blind. After my first impulse to jump up and go buy him an

@epicserve
epicserve / README.rst
Last active December 22, 2015 10:09
List the top pages for a website using Google Analytics

README

List the top pages for a website using Google Analytics. This is a base example that you could build off of to create lists on your website like, "Top Articles this Week", etc.

Installation

@lahwran
lahwran / programmingresources.md
Last active November 19, 2018 19:46
Programming learning resources

This list was originally authored by a friend who has been learning programming for some time (tuningmind)

Programming learning resources

Note: Many books may be available from a nearby public library. Check there as well!

These two are about the best I've seen for starting from scratch:

# All bindings refer to the current screen.
config defaultToCurrentScreen true
# Nudge/resize commands refer to % of screen sice.
config nudgePercentOf screenSize
config resizePercentOf screenSize
# my old divvy bindings (might wanna replace these some day?)
# corners: q/e/z/c for nw/ne/sw/se, quarter screen
alias resize-quarter resize:screenSizeX/2;screenSizeY/2
@jnoller
jnoller / gist:3848238
Created October 7, 2012 12:25
Updated DjangoCon US 2012 Torrent Links/Information
Original Torrent was missing a single talk; revised all the things.
Supplement Torrent from original Torrent File: http://goo.gl/Rckdg
Magnet: magnet:?xt=urn:btih:d4ecb90b455d557000c86953b9352094c994a864&dn=DjangoCon%20US%202012&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80
Updated Torrent (Full Conference): http://goo.gl/RK0yX
Magnet Link: magnet:?xt=urn:btih:be8aa997451566a9698eb4b6c54c45794c9a8419&dn=DjangoCon%20US%202012-Supplement&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80