Skip to content

Instantly share code, notes, and snippets.

@pfmoore
pfmoore / basic.cfg
Created April 30, 2014 15:15
Ubuntu server preseed file
# Default User
d-i passwd/user-fullname string XXXXXXXX
d-i passwd/username string XXXXXXXX
d-i passwd/user-password-crypted password XXXXXXXX
d-i user-setup/encrypt-home boolean false
d-i user-setup/allow-password-weak boolean true
# Time Zone, system clock is UTC
d-i time/zone string Europe/London
d-i clock-setup/utc-auto boolean true
@pfmoore
pfmoore / list.patch
Created August 21, 2014 19:48
pip list command patch
diff --git a/pip/commands/list.py b/pip/commands/list.py
index 3a0330a..3e4fcc7 100644
--- a/pip/commands/list.py
+++ b/pip/commands/list.py
@@ -45,6 +45,12 @@ class ListCommand(Command):
help=('If in a virtualenv that has global access, do not list '
'globally-installed packages.'),
)
+ cmd_opts.add_option(
+ '-L', '--location',
@pfmoore
pfmoore / vex.ps1
Created September 18, 2014 21:57
Powershell implementation of vex (virtualenv manager)
[CmdletBinding(DefaultParameterSetName="ByName")]
Param (
[Parameter(Position=0, Mandatory=$true, ParameterSetName="ByName")]
[String]
$VE,
[Parameter(Position=1)]
[ScriptBlock]$sb,
from cffi import FFI
ffi = FFI()
ffi.cdef('''
HANDLE FindFirstVolume(LPTSTR lpszVolumeName, DWORD cchBufferLength);
BOOL FindVolumeClose(HANDLE hFindVolume);
''')
lib = ffi.verify('''
/* Note - need UNICODE here as ffi won't auto-detect if we need it */
import zipfile
import hashlib
import csv
import sys
import os
import io
oldproj = 'pywin32'
newproj = 'pypiwin32'
filename = sys.argv[1]

TortoiseHG Silent Install Features

  • MainProgram
  • Locales
  • ShellExtensionX64
  • ShellExtensionX86
  • ThgDocumentation
  • KDiff3
  • SSHUtils
rom distutils import ccompiler
import setuptools # Needed to monkeypatch msvccompiler for Python 2.7
import os
here = os.path.dirname(os.path.abspath(__file__))
cc = ccompiler.new_compiler()
sources = [
'api.c',
@pfmoore
pfmoore / pathfix.py
Created March 15, 2013 15:00
Import this module at the start of a script to add version-specific subdirectories to sys.path. This lets you write generic scripts that use version-specific modules
import sys, os
here = os.path.dirname(os.path.abspath(__file__))
def add(name):
fullname = os.path.join(here, name)
if os.path.isdir(fullname):
sys.path.append(fullname)
add('py{0[0]}'.format(sys.version_info))
add('py{0[0]}{0[1]}'.format(sys.version_info))
@pfmoore
pfmoore / make_virtualenv_wrapper.py
Last active December 15, 2015 10:49
Virtualenv wrapper maker that (among other things) lets you specify things like -p 3.2 on Windows.
#!/usr/bin/env python
import os
import sys
import shutil
import tempfile
import subprocess
from glob import glob
from argparse import ArgumentParser
@pfmoore
pfmoore / loader_sample.py
Created March 28, 2013 15:39
Dummy importlib-based importer sample
from importlib.abc import PathEntryFinder, SourceLoader, FileLoader
from importlib.util import module_for_loader
class MyFinder(PathEntryFinder):
def __init__(self, pathentry):
"""Create a finder for the given `pathentry`"""
if pathentry == 'foo':
return
raise ImportError
def find_loader(self, fullname):