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
| // requires linked AVFoundation.framework | |
| // don't forget to import AVFoundation at the top of your controller | |
| var player:AVAudioPlayer = AVAudioPlayer() | |
| var error: NSError? = nil | |
| var p1sounds = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("filenamegoeshere", ofType: "mp3")!) | |
| player = AVAudioPlayer(contentsOfURL: p1sounds, error: &error) | |
| player.play() |
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
| ## yum: | |
| ## edit /etc/yum.conf | |
| ## command-line stuff: | |
| export http_proxy=http://user:[email protected]:80 | |
| export https_proxy=https://user:[email protected]:80 | |
| ## Github | |
| git config --global http.proxy user:[email protected]:80 | |
| git config --global https.proxy user:[email protected]:80 |
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
| 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 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
| @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 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/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 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
| export http_proxy=http://username:[email protected]:80 | |
| export https_proxy=http://username:[email protected]:80 |
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
| def speak(message, room): | |
| from requests.packages import urllib3 | |
| urllib3.disable_warnings() | |
| token = '...' | |
| url = "https://api.hipchat.com/v2/room/{1}/notification?auth_token={0}" . format (token, room) | |
| requests.post(url, {"message":message}) |
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
| redis-cli incr http_port | cut -c1-8 |
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
| # Get the ansible facts | |
| ansible -i {inventory_file} -u {username} -m setup {hostname} |
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
| # start / stop / restart / status | |
| systemctl start test | |
| systemctl stop test | |
| systemctl restart test | |
| systemctl status test | |
| # logs use journalctl: | |
| # tail the logs for unit `django` | |
| journalctl -f -u django |