Skip to content

Instantly share code, notes, and snippets.

View vsajip's full-sized avatar

Vinay Sajip vsajip

View GitHub Profile
#!/usr/bin/env python3
import sys
import socket
import select
def command(name, args=None):
return {'name': name, 'args': args}
def readcmd():
@vsajip
vsajip / bar.py
Created February 26, 2014 10:45 — forked from DasIch/bar.py
from nonlocal_ import nonlocal_
def foo():
a = 1
def bar():
nonlocal_('a')
a = 2
bar()
return a
Section "Device"
Identifier "VNC Device"
Driver "vesa"
EndSection
Section "Screen"
Identifier "VNC Screen"
Device "VNC Device"
Monitor "VNC Monitor"
SubSection "Display"
#!/usr/bin/env python
#
# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of Vinay Sajip
# not be used in advertising or publicity pertaining to distribution
@vsajip
vsajip / cu3test.py
Last active August 29, 2015 14:19
Script to find blockers to Python 3 adoption across all of PyPI
from collections import Counter
import logging
from pprint import pprint
import sys
import caniusepython3
from caniusepython3.dependencies import blocking_dependencies
logger = logging.getLogger(__name__)
--- C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.txt
+++ C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat
@@ -16,23 +16,23 @@
goto :eof
:amd64
-if not exist "%~dp0bin\amd64\vcvarsamd64.bat" goto missing
-call "%~dp0bin\amd64\vcvarsamd64.bat"
+if not exist "%~dp0bin\vcvars64.bat" goto missing
+call "%~dp0bin\vcvars64.bat"
#
# Copyright 2009 Vinay Sajip
#
import logging
logger = logging.getLogger(__name__)
class LogWriter:
def __init__(self, logger):
self.logger = logger
import logging.handlers
import smtplib
class BufferingSMTPHandler(logging.handlers.BufferingHandler):
def __init__(self, mailhost, fromaddr, toaddrs, subject, capacity):
logging.handlers.BufferingHandler.__init__(self, capacity)
self.mailhost = mailhost
self.mailport = None
self.fromaddr = fromaddr
if isinstance(toaddrs, (str, unicode)):
#
# Copyright (C) 2009 Vinay Sajip.
# Licensed under the PSF licence.
# Exploratory code to convert %-format strings to {}-format.
#
import re
PATTERN = re.compile(r'''
% # specifier start
@vsajip
vsajip / index.html
Last active September 23, 2015 09:27
Example graph
<!DOCTYPE html>
<title>Example graph</title>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
width: 960px;
height: 500px;
position: relative;