Skip to content

Instantly share code, notes, and snippets.

View vsajip's full-sized avatar

Vinay Sajip vsajip

View GitHub Profile
#!/usr/bin/env python
import os
import subprocess
import sys
from urllib import pathname2url
import selenium.webdriver
def run():
watch_command = 'inotifywait -rq -e close_write --exclude \'"*.html"\' .'.split()
make_command = 'make html'.split()
@vsajip
vsajip / sphinx-reload.py
Created January 27, 2012 22:05 — forked from delijati/sphinx-reload.py
watchdog example
# Run:
# $ virtualenv env
# $ cd env
# $ env/bin/pip install watchdog
# $ env/bin/pip install selenium
# $ env/bin/python sphinx-reload.py
import logging
import os
import selenium.webdriver
@vsajip
vsajip / array.c
Created January 23, 2014 14:14 — forked from TooTallNate/array.c
#include <stdio.h>
#include <ffi/ffi.h>
/* The struct with inlined arrays */
struct test {
int array[5];
char str[6];
};
/* The function to FFI invoke */
#!/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
@vsajip
vsajip / slackme
Last active October 14, 2015 09:12 — forked from onjin/slackme
#!/usr/bin/env python
"""
Usage:
using ~/.slackmerc file:
$ slackme some info # with `default` profile
$ slackme --profile alert some info # using `alert` profile
put profile in filename:
--- 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"
@vsajip
vsajip / _core.py
Created January 19, 2016 12:05 — forked from justanr/_core.py
Clean Architecture In Python
from abc import ABC, ABCMeta, abstractmethod
from collections import namedtuple
from functools import partial, singledispatch
from itertools import count
PayloadFactory = namedtuple('PayloadFactory', [
'good', 'created', 'queued', 'unchanged', 'requires_auth',
'permission_denied', 'not_found', 'invalid', 'error'
])
@vsajip
vsajip / .block
Last active February 23, 2016 08:45 — forked from mbostock/.block
Test Chart
license: gpl-3.0
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.grid {
width: 99%;
margin-left: auto;
margin-right: auto;