Skip to content

Instantly share code, notes, and snippets.

View davidbgk's full-sized avatar
🚪
Let’s escape GAFAM+ when/while we can!

David Larlet davidbgk

🚪
Let’s escape GAFAM+ when/while we can!
View GitHub Profile
@davidbgk
davidbgk / watch_turtle.py
Last active September 18, 2023 23:07 — forked from magopian/watch_turtle.py
Auto-reload turtle code on file save (https://docs.python.org/3/library/turtle.html)
"""Reloads the `my_turtle.py` code on save.
Put simple turtle instructions in the `my_turtle.py` file,
and they'll be re-run (on a clean window) on each file save.
Usage:
1/ put some turtle instructions in a `my_turtle.py` file
(eg `turtle.forward(100)`)
2/ run `python watch_turtle.py` on a commandline
(no dependencies needed)
@davidbgk
davidbgk / README.md
Created February 13, 2023 13:45 — forked from baldurbjarnason/README.md
Book production files for Out of the Software Crisis

Book production files

For Out of the Software Crisis.

These are under the MIT License. Do what you want, essentially. Probably doesn't work out of the box. Uses Pandoc, zx, weasyprint, and Literata.

You'll need to download them for this to work. And you'll need to edit the build script to point at the correct CSS files. And you'l need to edit the CSS to point at the correct font files.

@davidbgk
davidbgk / python.md
Created October 20, 2022 02:41 — forked from eyeseast/python.md
How to set up Python in 2022

Python

This is my recommended Python setup, as of Fall 2022. The Python landscape can be a confusing mess of overlapping tools that sometimes don't work well together. This is an effort to standardize our approach and environments.

Tools and helpful links:

@davidbgk
davidbgk / webmention.py
Last active July 4, 2022 01:22 — forked from karlcow/webmention.py
Using gunicorn
def server_app(environ, start_response):
method = environ.get('REQUEST_METHOD', 'GET')
if method == 'GET':
return get_response(start_response)
elif method == 'POST':
accept_header = environ.get('HTTP_ACCEPT', '*/*')
post_data = environ.get('wsgi.input').read()
return post_response(start_response, accept_header, post_data)
@davidbgk
davidbgk / web-servers.md
Created June 9, 2022 22:47 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@davidbgk
davidbgk / previewImageUploads.js
Created May 15, 2022 23:04 — forked from adactio/previewImageUploads.js
Show inline previews of images that are going to be uploaded.
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function (win,doc) {
'use strict';
if (!win.FileReader || !win.addEventListener || !doc.querySelectorAll) {
// doesn't cut the mustard.
return;
}
doc.querySelectorAll('input[type="file"][accept="image/*"]').forEach( function (fileInput) {
@davidbgk
davidbgk / README
Created May 9, 2016 05:57 — forked from thedod/README
Woof (one-time file exchange) + helper scripts
Woof is an amazingly simple and effective file exchange tool:
http://www.home.unix-ag.org/simon/woof.html
This distribution doesn't include simon Budig's original woof
(that started breaking for me), but Edward Samson's fork:
https://bitbucket.org/edu/woof
Desktop helper scripts:
filewoof and folderwoof "open with" actions for nautilus etc.
and woofget that runs "woof -U" in a terminal window in /tmp
(e.g. for a launcher button)
@davidbgk
davidbgk / github-proxy-client.js
Created March 17, 2022 02:39 — forked from DavidWells/github-proxy-client.js
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
@davidbgk
davidbgk / userChrome.css
Created October 12, 2021 13:34 — forked from maxlath/userChrome.css
Hide "Firefox suggests" text in Firefox 93 search menu
/*
Create or edit userChrome.css in your Firefox profile folder,
typically found on Linux at ~/.mozilla/firefox/[some firefox profile folder]/chrome/userChrome.css
*/
.urlbarView-row[label]{
margin-block-start: 0 !important;
}
.urlbarView-row[label]::before{
@davidbgk
davidbgk / Makefile
Created September 27, 2021 17:55 — forked from baldurbjarnason/Makefile
node-less frontend testing using Firefox and TAP
.PHONY:test
test:
rm -rf ./my-profile; mkdir ./my-profile && echo "user_pref('devtools.console.stdout.content', true);user_pref('dom.allow_scripts_to_close_windows', true);user_pref('datareporting.policy.firstRunURL', '');" > ./my-profile/user.js && firefox --headless -profile ./my-profile -no-remote `pwd`/index.html | sed -n "/console.log: /p" | sed -e 's/console.log: "//' -e 's/"$$//' | ./tapview