Here's a few things I tried to write output to a python subprocess pipe.
from subprocess import Popen, PIPE
p = Popen('less', stdin=PIPE)
for x in xrange(100):
p.communicate('Line number %d.\n' % x)
/** | |
* Infix to postfix notation RegExp converter | |
* | |
* To implement RegExp machine (NFA, DFA) we need | |
* to transform first RegExp string to postfix notation | |
* for more convinient work with the stack. This function | |
* does exactly this. | |
* | |
* See: http://swtch.com/~rsc/regexp/regexp1.html | |
* |
#!/usr/bin/python | |
# All SSH libraries for Python are junk (2011-10-13). | |
# Too low-level (libssh2), too buggy (paramiko), too complicated | |
# (both), too poor in features (no use of the agent, for instance) | |
# Here is the right solution today: | |
import subprocess | |
import sys |
Here's a few things I tried to write output to a python subprocess pipe.
from subprocess import Popen, PIPE
p = Popen('less', stdin=PIPE)
for x in xrange(100):
p.communicate('Line number %d.\n' % x)
#!/bin/bash | |
# | |
######################################################################### | |
#This software code is made available "AS IS" without warranties of any # | |
#kind. You may copy, display, modify and redistribute the software # | |
#code either by itself or as incorporated into your code; provided that # | |
#you do not remove any proprietary notices. Your use of this software # | |
#code is at your own risk and you waive any claim against Amazon # | |
#Digital Services, Inc. or its affiliates with respect to your use of # | |
#this software code. (c) 2006-2007 Amazon Digital Services, Inc. or its # |
#!/bin/bash | |
# | |
# -------------------------------------------------------------------- | |
# This is a free shell script under GNU GPL version 3.0 or above | |
# Copyright (C) 2005 ReFlectiv project. | |
# Feedback/comment/suggestions : http://www.reflectiv.net/ | |
# ------------------------------------------------------------------------- | |
# | |
# This script automatically set up a new *Debian* server (IMPORTANT : Debian!), by doing these actions : | |
# |
This configuration is not maintained anymore. You should think twice before using it, Breaking change and security issue will likely eventually happens as any abandonned project.
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
Recently, Everyday Hero has been doing a heap of work around the automation and provisioning of resources with AWS cloud services. This entails working frequently with the AWS API.
A useful filter we have been using in Ansible is taking output from a shell action and turning it into something we can consume via variables.
An example playbook is below: