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
cd into /tmp/kitchen. | |
/opt/chef/embedded/bin/gem install chef-zero | |
/opt/chef/embedded/bin/chef-zero -d | |
knife cookbook upload -a -c client.rb | |
chef-shell -z -c client.rb -o '<YOUR RECIPE>' |
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
Tue Jan 24 21:08:34 UTC 2017 |
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
from sqlalchemy import Column, Integer, String | |
class Animal(Base): | |
__tablename__ = 'animals' | |
id = Column(Integer, primary_key=True) | |
common_name = Column(String) | |
latin_name = Column(String) | |
kingdom = Column(String) | |
def __init__(self, common_name, latin_name, kingdom): |
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
class TweetSearch < ActiveRecord::Base | |
attr_accessible :status, :tweet_id, :user | |
def self.query(search_item="pizza") | |
starttime = Time.now | |
result = Twitter.search(search_item, :count => 10, :result_type => "recent").results.first | |
tweettime = ((Time.now - starttime) * 1000).to_i | |
METRICS.timing('tweetsearch.query', tweettime) | |
return result | |
end |
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 subprocess | |
import statsd | |
import re | |
import argparse | |
parser = argparse.ArgumentParser(description='Send num processes to StatsD') | |
parser.add_argument('servername', metavar='S', type=str, | |
help='The server that is generating this process list.') | |
args = parser.parse_args() |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 hello(): | |
print 'Hello!' | |
def area_rectangle(width, height): | |
return width * height | |
def area_square(side): | |
return side*side |
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 re | |
re.compile( | |
''' | |
(\d{3}) # Search for 3 digits and group them. | |
\D* # Followed by 0 or more non digit characters. | |
(\d{3}) # Followed by 3 digits grouped. | |
\D* # Followed by 0 or more non digit characters. | |
(\d{4}) # Followed by 4 digits grouped. |
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 re | |
divine_comedy = """ | |
Test word universe should not match. | |
*** START *** | |
His glory, by whose might all things are mov'd, | |
Pierces the universe, and in one part | |
One more universe. |
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 re | |
address = re.compile( | |
''' | |
# The regular name | |
(?P<first_name>\w+) | |
\s+ | |
(([\w.]+)\s+)? # optional middle name or initial | |
(?P<last_name>\w+) |
NewerOlder