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
| string address = "http://<TEAMCITY>/httpAuth/app/rest/agents/id:1/enabled"; | |
| byte[] data = Encoding.UTF8.GetBytes("false"); | |
| using (var client = new System.Net.WebClient()) | |
| { | |
| client.UseDefaultCredentials = true; | |
| client.Credentials = new NetworkCredential("<USER>", "<PASSWORD>"); | |
| byte[] response = client.UploadData(address, "PUT", data); | |
| } |
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 urllib2 | |
| opener = urllib2.build_opener(urllib2.HTTPHandler) | |
| request = urllib2.Request('http://<TEAMCITY>/httpAuth/app/rest/agents/id:1/enabled', data='false') | |
| request.add_header('Content-Type', 'text/plain') | |
| request.get_method = lambda: 'PUT' | |
| url = opener.open(request) |
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
| input { | |
| udp { | |
| port => 5959 | |
| type => "Win32-EventLog" | |
| format => "json" | |
| } | |
| } | |
| output { | |
| stdout { |
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
| OS Name: Microsoft Windows 7 Enterprise | |
| OS Version: 6.1.7601 Service Pack 1 Build 7601 | |
| java version "1.6.0_65" | |
| Java(TM) SE Runtime Environment (build 1.6.0_65-b14) | |
| Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04, mixed mode) |
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
| OS Name: Microsoft Windows 7 Enterprise | |
| OS Version: 6.1.7601 Service Pack 1 Build 7601 | |
| java version "1.6.0_65" | |
| Java(TM) SE Runtime Environment (build 1.6.0_65-b14) | |
| Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04, mixed mode) |
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
| (Python 2.7.3 on linux2) Traceback (most recent call last): | |
| File "/vagrant/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1828, in Main | |
| MyBuild.Launch() | |
| File "/vagrant/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1595, in Launch | |
| self._MultiThreadBuildPlatform() | |
| File "/vagrant/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1402, in _MultiThreadBuildPlatform | |
| self.Progress | |
| File "/vagrant/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", line 130, in __new__ | |
| if not AutoGenObject._Init(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs): | |
| File "/vagrant/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", line 300, in _Init |
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
| # Calculates the hamming distance and the edits between two strings | |
| def hamming(s1, s2, key=hash): | |
| assert len(s1) == len(s2) | |
| dist = 0 | |
| edits = [] | |
| for i in xrange(len(s1)): | |
| if s1[i] == s2[i]: | |
| edits.append({'type':'match', 'i':i, 'j':i}) |
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
| # Calculates the levenshtein distance and the edits between two strings | |
| def levenshtein(s1, s2, key=hash): | |
| rows = costmatrix(s1, s2, key) | |
| edits = backtrace(s1, s2, rows, key) | |
| return rows[-1][-1], edits | |
| # Generate the cost matrix for the two strings | |
| # Based on http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#Python | |
| def costmatrix(s1, s2, key=hash): |
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
| // Extended DateTime constants and strinify | |
| class DateTimeEx | |
| { | |
| public static DateTime NextYear { get { return DateTime.Today.AddDays(-DateTime.Today.DayOfYear + 1).AddYears(1); } } | |
| public static DateTime NextMonth { get { return DateTime.Today.AddDays(-DateTime.Today.Day + 1).AddMonths(1); } } | |
| public static DateTime NextWeek { get { return DateTime.Today.AddDays(7 - (DateTime.Today.DayOfWeek - CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek)); } } | |
| public static DateTime Tomorrow { get { return DateTime.Today.AddDays(1); } } | |
| public static DateTime Now { get { return DateTime.Now; } } | |
| public static DateTime Today { get { return DateTime.Today; } } | |
| public static DateTime Yesterday { get { return DateTime.Today.AddDays(-1); } } |
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 sys | |
| from optparse import OptionParser | |
| def command(options, args): | |
| function, parameters = args[0], args[1:] | |
| print "You typed: {0}({1})".format(function, parameters) | |
| def interactive(options, args): | |
| print "Python interactive window. Type $help for a list of commands." |