Skip to content

Instantly share code, notes, and snippets.

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@evansde77
evansde77 / mock_requests.py
Last active December 28, 2024 15:07
Example of mocking requests calls
#!/usr/bin/env python
"""
mocking requests calls
"""
import mock
import unittest
import requests
from requests.exceptions import HTTPError
@marians
marians / CouchDB_Python.md
Last active September 1, 2024 00:19
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module

@tdpreece
tdpreece / simple_http_server.sh
Created September 25, 2015 16:38
Running a Python SimpleHTTPServer in the background and killing it when doneSimpleHTTPServer
#!/usr/bin/env bash
# Create a page in the current dir
echo "My Test Page" > test.html
# Start server
python -m SimpleHTTPServer 8000 &> /dev/null &
pid=$!
# Give server time to start up
@sloria
sloria / bobp-python.md
Last active April 17, 2025 08:09
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@nikos
nikos / build.gradle
Created December 17, 2012 17:30
Simple (aka minimal) Gradle script to create ZIP archive file and upload to nexus repository (as snapshot or if you modify the version to release)
apply plugin: 'maven'
group = 'de.sample'
version = '0.1-SNAPSHOT'
description = 'My cool tool ...'
task customZip(type: Zip) {
from ('.') {