Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View davidhalter's full-sized avatar

Dave Halter davidhalter

View GitHub Profile
@davidhalter
davidhalter / curl.py
Created September 27, 2021 10:27
curl.py - A way to debug Django Requests
import logging
import pdb
import time
from contextlib import contextmanager
from django.core.management.base import BaseCommand
from django.test import Client
from django.conf import settings
from django.db import connection
@davidhalter
davidhalter / conftest.py
Created July 29, 2020 14:08
Pytest 5 Remote PDB
import socket
import pdb
def pytest_addoption(parser):
parser.addoption("--remote-pdb", action='store_true',
help="Opens a remote pdb on localhost:8050. Works with xdist")
def pytest_exception_interact(node, call, report):
if node.config.option.remote_pdb:
tb = call.excinfo._excinfo[2]
@davidhalter
davidhalter / pep484transform.py
Created December 18, 2015 17:57
Jedi generates Pep 484 type annotations.
"""
Transforms a normal Python file to pep484 annotations using Jedi.
Usage:
pep484transform.py <file> [-d]
Options:
-d, --debug Show Jedi's debug output.
"""
from os.path import abspath
@davidhalter
davidhalter / gist:4595055
Created January 22, 2013 14:32
download grooveshark favorites and song collection (with library).
#!/usr/bin/env python
import os
import json
import grooveshark
client = grooveshark.Client()
client.init()
@davidhalter
davidhalter / Makefile
Created April 29, 2012 20:00
Makefile. No filenames needed.
# -------------------------------------------------------
# Makefile to build whatever you want.
# It tries to find all the sources you have and builds
# dependencies, to detect header file changes.
# This is especially helpful for C/C++ beginners,
# who don't want to edit a Makefile.
# https://gist.github.com/2552967
# Written by David Halter <davidhalter88@gmail.com>
# -------------------------------------------------------
CC=g++