Skip to content

Instantly share code, notes, and snippets.

@pfmoore
pfmoore / ve20.log
Created January 28, 2020 15:29
Virtualenv 20 logfile
767 setup logging to NOTSET [DEBUG report:43]
825 find interpreter for spec PythonSpec(str_spec=C:\Users\UK03306\AppData\Local\Programs\Python\Python38\python.exe, path=C:\Users\UK03306\AppData\Local\Programs\Python\Python38\python.exe) [INFO builtin:44]
825 proposed PythonInfo(spec=CPython3.8.0.final.0-64, exe=C:\Users\UK03306\AppData\Local\Programs\Python\Python38\python.exe, platform=win32, version='3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)]', encoding_fs_io=utf-8-cp1252) [INFO builtin:48]
825 accepted target interpreter PythonInfo(spec=CPython3.8.0.final.0-64, exe=C:\Users\UK03306\AppData\Local\Programs\Python\Python38\python.exe, platform=win32, version='3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)]', encoding_fs_io=utf-8-cp1252) [INFO builtin:50]
862 symlink on filesystem does not work [DEBUG info:47]
866 filesystem is not case-sensitive [DEBUG info:28]
1162 create virtual environment via CPython3Windows(dest=ve20test, global=False, cl
@pfmoore
pfmoore / lea_examples.py
Created November 13, 2018 15:21
Lea snippets
import lea
from lea import markov
lea_obj = lea.vals('abcde')
ch = markov.chain_from_seq('abgdkjhagbdffagg')
# To get the probability distribution from an Alea object:
probs = list(zip(lea_obj.support, lea_obj.ps))
# To get the transition matrix from a Markov chain object:
@pfmoore
pfmoore / upgrade-issues.md
Created June 19, 2018 19:52
Master Issue for problems after upgrading pip on Linux

Overview

After upgrading to pip 10 on Linux, many users are encountering variations of the error ImportError: cannot import name 'main'. These are caused by an incorrect attempt to upgrade pip, which has typically resulted in (parts of) multiple versions of pip being installed in the same Python installation, and those parts being incompatible.

It should be noted that these issues are invariably not problems with pip itself, but are due to incorrect use of pip, or unexpected interactions with system scripts that are not controlled by pip. So while we'll try to help you solve your issue, this is not the "fault" of pip, and you will have to be prepared to do at least some of the debugging and fixes on your own.

General Advice

First, some general advice. It is assumed that anyone encountering issues will have failed to follow some part of this advice. Listing these items here is not intended to imply that "it's your fault and we won't help", but rather to help users to identify what went wrong, so

[
{
"pos": {
"x": 0,
"y": 0
},
"opcode": {
"id": "ev_rs_on",
"primary": "D",
"parameters": [
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',

TortoiseHG Silent Install Features

  • MainProgram
  • Locales
  • ShellExtensionX64
  • ShellExtensionX86
  • ThgDocumentation
  • KDiff3
  • SSHUtils
import zipfile
import hashlib
import csv
import sys
import os
import io
oldproj = 'pywin32'
newproj = 'pypiwin32'
filename = sys.argv[1]
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 */
@pfmoore
pfmoore / utils.ps1
Created December 15, 2014 15:35
Useful Powershell Snippets
# Use this one to load this snippet :-)
function Invoke-URLContent ($url) {
(New-Object Net.WebClient).DownloadString($url) | Invoke-Expression
}
function Get-URLContent ($url, $path) {
if (!$path) {
$path = Join-Path $pwd.Path ([URI]$url).Segments[-1]
}
(New-Object Net.WebClient).DownloadFile($url, $path)
@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,