Skip to content

Instantly share code, notes, and snippets.

View dnedbaylo's full-sized avatar

Dmitry Nedbaylo dnedbaylo

View GitHub Profile
import email.utils
from requests.packages.urllib3.packages import six
def format_header_param(name, value):
"""
Helper function to format and quote a single header parameter.
Particularly useful for header parameters which might contain
non-ASCII values, like file names. This follows RFC 2231, as
@dnedbaylo
dnedbaylo / install-chef.sh
Created January 6, 2012 10:36
Install chef-solo on ubuntu 10.04
#!/bin/bash
echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | tee /etc/apt/sources.list.d/opscode.list
mkdir -p /etc/apt/trusted.gpg.d
gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
gpg --export [email protected] | sudo tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
apt-get update
apt-get install opscode-keyring -y
apt-get upgrade -y
apt-get install chef -y
@dnedbaylo
dnedbaylo / PersistentWebdriver.py
Created March 3, 2011 09:39
PersistentWebdriver
from selenium import webdriver
from selenium.webdriver.remote.remote_connection import RemoteConnection
from selenium.webdriver.remote.errorhandler import ErrorHandler
from selenium.webdriver.remote.command import Command
class PersistentWebdriver (webdriver.Remote):
def __init__(self, session_id=None, browser_name=''):
command_executor='http://localhost:4444/wd/hub'