Skip to content

Instantly share code, notes, and snippets.

View carltongibson's full-sized avatar
🌳
Pruning branches

Carlton Gibson carltongibson

🌳
Pruning branches
View GitHub Profile
@adamchainz
adamchainz / test_example.py
Created May 14, 2021 10:42
parameterized-data
from copy import deepcopy
import pytest
from django.contrib.auth.models import User
users = [
User(username="a"),
User(username="b"),
]
@tiran
tiran / python-on-debian.md
Last active May 21, 2024 08:46
Negative Python user experience on Debian/Ubuntu

Negative Python user experience on Debian/Ubuntu

The user experience of Python on a minimal Debian or Ubuntu installation is bad. Core features like virtual environments, pip bootstrapping, and the ssl module are either missing or do not work like designed and documented. Some Python core developers including me are worried and consider Debian/Ubuntu's packaging harmful for Python's reputation and branding. Users don't get what they expect.

Reproducer

The problems can be easily reproduced with official Debian and Ubuntu containers in Docker or Podman. Debian Stable (Debian 10 Buster) comes with Python 3.7.3. Ubuntu Focal (20.04 LTS) has Python 3.8.5.

Run Debian container

@booyaa
booyaa / wsl2-workarounds.md
Created February 7, 2020 10:39
WSL2 workarounds

WSL2 known issues and their workarounds

WSL2: docker: Error response from daemon: cgroups: cannot find cgroup mount destination: unknown.

issues:

workaround

@enricofoltran
enricofoltran / main.go
Last active June 26, 2024 12:16
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"

Lightning Talk proposal for ReactiveConf 2017 http://www.reactiveconf.com #ReactiveConf

Porting Prezi to Elm in 99 lines of code

Elm is a statically-typed functional programming language. Its compiler produces safe JavaScript which is guaranteed to be free of runtime exceptions. Moreover Elm is packed with a bunch of powerful abstractions which let us build visual and reactive Web applications in a few lines of code.

As an example, I show the implementation of a simple framework for building Prezi-like presentations. It's just 99 lines of code!

@omz
omz / UI Debugging Overlay.py
Last active January 6, 2024 05:44
UI Debugging Overlay.py
# Pythonista script to show the UI Debugging overlay (private API) described in this blog post:
# http://ryanipete.com/blog/ios/swift/objective-c/uidebugginginformationoverlay/
from objc_util import ObjCClass, on_main_thread
UIDebuggingInformationOverlay = ObjCClass('UIDebuggingInformationOverlay')
@on_main_thread
def toggle_overlay():
UIDebuggingInformationOverlay.prepareDebuggingOverlay()
UIDebuggingInformationOverlay.overlay().toggleVisibility()
@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.
@Rich-Harris
Rich-Harris / please-include-a-repro.md
Last active May 20, 2024 09:50
Please include a repro

Please include a repro

You probably arrived here because of a curt message in response to an issue you filed on a repo that I contribute to. Sorry about that (particularly if you filed the issue long ago and have been waiting patiently for a response). Let me explain:

I work on a lot of different open source projects. I really do like building software that makes other people's lives easier, but it's crazy time-consuming. One of the most time-consuming parts is responding to issues. A lot of OSS maintainers will bend over backwards to try and understand your specific problem and diagnose it, to the point of setting up new test projects, fussing around with different Node versions, reading the documentation for build tools that we don't use, debugging problems in third party dependencies that appear to be involved in the problem... and so on. I've personally spent hundreds of hours of my free time doing these sorts of things to try and help people out, because I want to be a responsible maintainer and I

@jiaaro
jiaaro / _INSTRUCTIONS.md
Last active January 22, 2024 17:47
Using Swift libraries in Python

Using Swift libraries in Python

So... this is obviously totally, 100%, like for. real. not. supported. by. Apple. …yet?

But still... I thought it was pretty badass. And, seeing how there's already a Swift buildpack for Heroku you could move some slow code into Swift can call it as a library function. But, you know, not in production or anything. That would be silly, right?

Now, having said that, the actual Python/Swift interop may have bugs. I'll leave that as an exercise to the reader.

How to get Python code calling Swift functions:

@RobertKolner
RobertKolner / disable_signals.py
Last active August 15, 2018 10:11
[Note: for a better version, visit here: https://github.com/RobertKolner/django-signal-disabler] Temporarily disable all signals in django
from collections import defaultdict
from django.db.models.signals import *
class DisableSignals(object):
def __init__(self, disabled_signals=None):
self.stashed_signals = defaultdict(list)
self.disabled_signals = disabled_signals or [
pre_init, post_init,
pre_save, post_save,