Skip to content

Instantly share code, notes, and snippets.

View cablehead's full-sized avatar

Andy Gayton cablehead

View GitHub Profile
import vanilla
h = vanilla.Hub()
b = h.bean(8080)
@b.websocket('/')
def _(ws):
child = h.process.execv(['/usr/bin/env', 'grep', '--line-buffered', 'foo'])
child.stdout.pipe(ws)
> python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import vanilla
>>> h = vanilla.Hub()
>>> child = h.process.execv(['/usr/bin/env', 'grep', '--line-buffered', 'foo'])
>>> child.stdin.send('foo1\n')
>>> child.stdout.recv()
'foo1\n'
@cablehead
cablehead / gist:668a410b464642c81870
Created March 12, 2015 06:10
Google API OAuth from Command Line
import argparse
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client import tools
def main():
storage = Storage('a_credentials_file')
creds = storage.get()
containers:
consul:
setup:
- !Env
VERSION: "0.4.1_linux_amd64"
- !Alpine v3.1
- !BuildDeps [wget, go, git, gcc, musl-dev, libgcc]
- !Sh |
set -ex
cd /tmp
#!/usr/bin/env python
import requests
import json
from oauth2client.client import GoogleCredentials
SCOPE = (
'https://www.googleapis.com/auth/datastore',
'https://www.googleapis.com/auth/userinfo.email', )
@cablehead
cablehead / -
Created January 15, 2015 01:49
foo
import operator
import select
import fcntl
import os
class EPoll(object):
def __init__(self):
self.q = select.epoll()
#!/usr/bin/env python
from suds.client import Client
from suds.wsse import Security
from suds.wsse import UsernameToken
URL = 'https://wd5-impl-services1.workday.com/ccx/service/osv_uber1/Human_Resources/v22.1?wsdl'
#!/usr/bin/env python
from suds.client import Client
from suds.wsse import Security
from suds.wsse import UsernameToken
URL = 'https://wd5-impl-services1.workday.com/ccx/service/Human_Resources?wsdl'
USERNAME = '...'
#!/usr/bin/env python
from suds.client import Client
from suds.wsse import Security
from suds.wsse import UsernameToken
URL = 'https://wd5-impl-services1.workday.com/ccx/service/Human_Resources?wsdl'
USERNAME = '...'