This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run this with: uwsgi --virtualenv venv --socket /tmp/uwsgi.sock --chmod-socket --plugin gevent --gevent 1000 --gevent-monkey-patch --module echo:application --master --processes 4 --enable-threads | |
from flask import Flask, request, render_template | |
import gevent | |
import logging | |
from uwsgi_websockets.middleware import ws_middleware | |
import uwsgi | |
logging.basicConfig(level=logging.DEBUG) | |
logger = logging.getLogger(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gssapi | |
from ldap3 import Connection, SASL_AVAILABLE_MECHANISMS | |
from ldap3.protocol.sasl.digestMd5 import sasl_digest_md5 | |
from ldap3.protocol.sasl.external import sasl_external | |
from ldap3.protocol.sasl.sasl import send_sasl_negotiation, abort_sasl_negotiation | |
SASL_AVAILABLE_MECHANISMS.append('GSSAPI') | |
def sasl_gssapi(connection, controls): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import base64 | |
import struct | |
import sys | |
from gssapi import sec_contexts, names | |
from gssapi.raw.types import NameType, RequirementFlag | |
SEC_LAYER_NONE = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[vagrant@localhost python-gssapi]$ sudo tox | |
GLOB sdist-make: /home/vagrant/python-gssapi/setup.py | |
py27 create: /home/vagrant/python-gssapi/.tox/py27 | |
py27 installdeps: nose, nose_parameterized, flake8, git+https://github.com/DirectXMan12/should_be.git, Cython, six | |
py27 inst: /home/vagrant/python-gssapi/.tox/dist/PythonGSSAPI-1.0.0.zip | |
ERROR: invocation failed, logfile: /home/vagrant/python-gssapi/.tox/py27/log/py27-2.log | |
ERROR: actionid=py27 | |
msg=installpkg | |
cmdargs=[local('/home/vagrant/python-gssapi/.tox/py27/bin/pip'), 'install', '--pre', '/home/vagrant/python-gssapi/.tox/dist/PythonGSSAPI-1.0.0.zip'] | |
env={'LANG': 'en_GB.UTF-8', 'USERNAME': 'root', 'TERM': 'xterm-256color', 'SHELL': '/bin/bash', 'SUDO_COMMAND': '/bin/tox', 'HOSTNAME': 'localhost.localdomain', 'SUDO_UID': '900', 'LC_CTYPE': 'en_GB.UTF-8', 'HISTSIZE': '1000', 'PYTHONIOENCODING': 'utf_8', 'PYTHONHASHSEED': '3968196433', 'LOGNAME': 'root', 'USER': 'root', 'MAIL': '/var/spool/mail/vagrant', 'PATH': '/home/vagrant/python-gssapi/.tox/py27/bin:/sbin: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Generated by Cython 0.21.1 */ | |
#define PY_SSIZE_T_CLEAN | |
#ifndef CYTHON_USE_PYLONG_INTERNALS | |
#ifdef PYLONG_BITS_IN_DIGIT | |
#define CYTHON_USE_PYLONG_INTERNALS 0 | |
#else | |
#include "pyconfig.h" | |
#ifdef PYLONG_BITS_IN_DIGIT | |
#define CYTHON_USE_PYLONG_INTERNALS 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def f1(y): | |
... return set(x for x in y) | |
... | |
>>> def f2(y): | |
... return {x for x in y} | |
... | |
>>> dis.dis(f1) | |
2 0 LOAD_GLOBAL 0 (set) | |
3 LOAD_CONST 1 (<code object <genexpr> at 0x10abecd30, file "<stdin>", line 2>) | |
6 MAKE_FUNCTION 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IF=en0 | |
MAC=`python << EOF | |
import random | |
print ":".join("%02X"%x for x in (random.randint(0, 255) for _ in range(6))) | |
EOF | |
` | |
echo "resetting wifi on $IF, rotating mac $MAC" | |
scselect -n | |
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LIBDRM_CFLAGS := $(shell pkg-config --cflags libdrm) | |
LIBDRM_LIBS := $(shell pkg-config --libs libdrm) | |
.PHONY = all clean | |
all: setgamma | |
clean: | |
rm setgamma *.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import fnmatch | |
import os | |
import re | |
import sys | |
MIXED_TABS_SPACES = re.compile(r"^\t* +(\t+)") | |
TRAILING_WHITESPACE = re.compile(r"(.*)([ \t\r\f\v]+)$") |