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
## yum: | |
## edit /etc/yum.conf | |
## command-line stuff: | |
export http_proxy=http://user:pass@proxy.mycompany.com:80 | |
export https_proxy=https://user:pass@proxy.mycompany.com:80 | |
## Github | |
git config --global http.proxy user:pass@proxy.mycompany.com:80 | |
git config --global https.proxy user:pass@proxy.mycompany.com:80 |
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 requests | |
from requests.auth import HTTPBasicAuth | |
url = 'http://jenkins.mycompany.com/api/json' | |
username = '..' | |
token = '..' | |
response = requests.get(url, auth=HTTPBasicAuth(username, token)) |
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
@patch.object(TaskHelper, "get_parent") | |
def test_mocking(self, mock_get_parent): | |
responses = [Exception('boom'), 'response'] | |
mock_get_parent.side_effect = lambda *args, **kw: responses.pop(0) | |
result = TaskHelper.get_parent() | |
if isinstance(result, Exception): | |
raise result | |
result = TaskHelper.get_parent() |
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
#!/usr/bin/python | |
import re, sys | |
message_file = sys.argv[1] | |
f = open(message_file) | |
message = f.read() | |
p = re.compile('^\[\#\d+\]') | |
if p.match(message) is None: | |
print "This commit needs a pivotal story ID. e.g.: git commit -am'[#82695812] - message goes here .. ' where 82695812 is your pivotal story ID" |
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
export http_proxy=http://username:password@mycompany.proxy.com:80 | |
export https_proxy=http://username:password@mycompany.proxy.com:80 |
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
redis-cli incr http_port | cut -c1-8 |
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
# Get the ansible facts | |
ansible -i {inventory_file} -u {username} -m setup {hostname} |
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
{ | |
"name": "jenkins", | |
"active": true, | |
"events": [ | |
"push" | |
], | |
"config": { | |
"jenkins_hook_url": "http://ci.jenkins-ci.org/github-webhook/" | |
} | |
} |
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
$.getScript("http://j.maxmind.com/app/geoip.js",function(){ | |
console.log(geoip_country_code()); | |
console.log(geoip_country_name()); | |
console.log(geoip_city()); | |
console.log(geoip_region()); | |
console.log(geoip_region_name()); | |
console.log(geoip_latitude()); | |
console.log(geoip_longitude()); | |
console.log(geoip_postal_code()); | |
}); |
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
""" | |
requirements: | |
pip install django_mailchimp | |
""" | |
import mailchimp | |
def add_to_list(self,request, list_id, email): | |
mailinglist = mailchimp.utils.get_connection().get_list_by_id(list_id) | |
return mailinglist.subscribe(email,{'EMAIL':email}) # True / False |