This file contains hidden or 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 | |
dict_1 = {'apple': 'red', 'banana': 'yellow', 'guava': 'green', 'orange': 'orange'} | |
dict_2 = {'apple': 'red', 'banana': 'yellow', 'grapes': 'green', 'orange': 'orange', 'guava': 'red',} | |
# Nested list comps to get keys of common dict items | |
ks = [i for i in [k for k in dict_1 if k in dict_2] if dict_1[i] == dict_2[i] ] | |
for k in ks: | |
print k, dict_1[k] |
This file contains hidden or 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 | |
words = ['madam', 'dalada', 'kayak', 'civic'] | |
print 'Palindrome test using range, loop and array index' | |
for word in words: | |
word_r = "".join([word[i] for i in range(len(word)-1, -1, -1)]) | |
if word == word_r: | |
print "%s is palindrome" %word |
This file contains hidden or 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 | |
# Description: A Git pre-commit hook for Puppet manifests | |
# Validates Puppet manifest syntax amd style | |
# * Syntax validation: Using puppet parser as documented on Puppet wiki | |
# - http://projects.puppetlabs.com/projects/1/wiki/Puppet_Version_Control | |
# * Style validation: Using puppet lint | |
# Requirements: | |
# * Ruby 1.8.7 |
This file contains hidden or 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 | |
# Clear VM's network config | |
rm /etc/udev/rules.d/70-persistent-net.rules | |
rm /etc/sysconfig/network-scripts/ifcfg-eth0 | |
rm /etc/resolv.conf | |
rm /etc/sysconfig/network |