A simple example to help understand Python decorators

September 19th, 2011

I thought this might help people better visualize what happens where and when in Python decorators.
Note: for some reason pastie.org adds an extra “@” for the @decorator_name syntax. Don’t know what to do about it.

Google voice comedy

August 18th, 2010

Yea for Google Voice transcription:
Another funny one (2010-11-17 from Jeld-Wen window company):
“”"
Hello 3, hey baby, but. Hello. Hey, you do require that. Yeah for the walmart, hey HI This is. The three fifths that okay bye to drive or what 60. Drive, Hi, Thomas. Hello.
“”"
Hmm, that was supposed to be about scheduling a technicians visit.

“”"
Hey Matt, I was gonna miss you get a real i guess it up. Maybe tomorrow. This letter tiny bit on hold because al bridge. Uncle in law, so awful ever while helping him do some work at the house yesterday and apparently, so I signed my resume but he said he’s totally OK, and the valve Richard worry about it anymore. But I’ll put shows what’s up, so short, we’re probably still gonna go and officially you’re You’re welcome. And because this is. That’s my fault for we’ll see you bye.
“”"

Shell trick: track new tcp connections per second in Linux

February 11th, 2010

This little snippet is for when you want to see new active connections per second, not concurrent established, as most tools show you:


C=0; while true; do echo "new connections: $C"; c1=`netstat -s -t|grep "active connections openings"|awk '{print $1;}'`; sleep 1; c2=`netstat -s -t|grep "active connections openings"|awk '{print $1;}'`; C=`expr $c2 - $c1` ; done

Enjoy!

Introducing: Business Engineering, the evolution of Business Intelligence

February 11th, 2010

Define intelligence:

Intelligence is a characteristic of thinking, but it is also a thing to be acquired. This substance is different than information. Intelligence is information that has been discovered, processed, and presented in a way that encourages its other definition: disciplined, insightful thinking.

Define engineering:

Engineering is the deliberate, analytical, scientific application of intelligence to the design or modification of a system.

Most data floated as Business Intelligence is more accurately labeled business information. It becomes the substance Business Intelligence when superior tools expose patterns and trends that are actionable.

Business Engineering is the practice of managing decisions based on critical analysis of intelligence about internal and external factors influencing the business.

RescueTime allows businesses to tweak the previously hidden algorithms that drive productivity of workforces. Data is scientifically gathered, and innovatively processed and presented in real time.

Businesses can re-balance work loads, uncover inefficiencies, and identify stalled or unusually successful projects while they are happening. Smart managers can introduce a measure of science into management itself: easily visualized historical information exposes trends one week to the next. Try several workflow processes, prove which one works best for each team.

Ruby for are these chars in this string…

February 11th, 2010

I find myself wanting to know if the characters in one string are in another.
For example, if you have a key space for a string key name, making sure the provided key is valid.


require 'set'
def chars_subset_of? checkme, inme
checkme.split(//).to_set.subset? inme.split(//).to_set
end

You could also toss this inside class String to dynamically add the method


require 'set'
def chars_subset_of? other_string
if other_string.class == String
self.split(//).to_set.subset? other_string.split(//).to_set
else # just try
self.split(//).to_set.subset? other_string.to_set
end
end