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
$ time ab -n 100 -c 1 'http://localhost:9200/logs/_search?q=x' | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking localhost (be patient).....done | |
Server Software: | |
Server Hostname: localhost |
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
# this outputs the download count of a PPA | |
# | |
# See https://api.launchpad.net/+apidoc/devel.html#binary_package_publishing_history | |
# See https://help.launchpad.net/API/launchpadlib | |
from launchpadlib.launchpad import Launchpad | |
cachedir = '/home/rgl/.launchpadlib/cache/' | |
launchpad = Launchpad.login_anonymously('just testing', 'production', cachedir) |
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
// | |
// Recreate (drop and create) an SQL Server Database. | |
// | |
// NB: This will place the database in single mode (also rolling back current transactions). | |
// | |
// usage: RecreateDatabase(@"Data Source=.\SQLServer; Initial catalog = ESB_Store_Development; Integrated Security=True;"); | |
private static void RecreateSqlServerDatabase(string connectionString) | |
{ | |
const string databaseNameRegexPattern = @"(;\s*Initial Catalog\s*=\s*)([^;]+)\s*"; |
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
// NB you should probably use SixPack instead... | |
// On App.config: | |
/* | |
<configuration> | |
<configSections> | |
<section name="snmpPoller" type="Tracing.Service.Snmp.SnmpPollerSettings,Tracing.Service.Snmp"/> | |
</configSections> | |
<snmpPoller pollingInterval="4000" timeout="3000"> | |
<variables> |
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
/* | |
When you have a XML schema with a xsd:anyType element, eg: | |
<complexType name="Example"> | |
<sequence> | |
<element name="DateTime" type="dateTime" minOccurs="1" maxOccurs="1" /> | |
<element name="Value" type="string" minOccurs="1" maxOccurs="1" /> | |
<element name="Details" type="anyType" minOccurs="0" maxOccurs="1" /> | |
</sequence> | |
</complexType> |
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
private static HealthState GetHealthState() | |
{ | |
// addresses is-a List<string> | |
var addresses = GetServers().SelectMany(s => s.IPs.Where(ip => ip.Type == "Backend").Select(ip => ip.Value)); | |
var totalAddresses = addresses.Count(); | |
var cancellationTokenSource = new CancellationTokenSource(); |
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
# | |
# Copy this file into the user package directory (eg. to C:\Users\Rui Lopes\AppData\Roaming\Sublime Text 3\Packages\User). | |
# NB you can go into this directory by opening the Preferences | Browse Packages... menu. | |
# | |
# Add a shortcut to run this command by using sublime Preferences | Key Bindings - User: | |
# | |
# [ | |
# { | |
# "keys": ["ctrl+shift+x"], | |
# "command": "tidy_xml_lint" |
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
var http = require("http"); | |
var url = require("url"); | |
var pathHandlers = { | |
"/": function(request, response, uri) { | |
response.writeHead(200, {"Content-Type": "text/html"}); | |
response.write("<ul>\n"); | |
response.write("<li><a href='status?code=404'>status - 404</a></li>\n"); | |
response.write("<li><a href='status?code=500'>status - 500</a></li>\n"); | |
response.write("<li><a href='sleep?duration=5000'>sleep - 5s</a></li>\n"); |
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
using log4net; | |
using System; | |
using System.IO; | |
using System.Timers; | |
using System.Web.Hosting; | |
namespace Util | |
{ | |
public class AssetHelperJanitor | |
{ |
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
# | |
# Copy this file into the user package directory (eg. to C:\Users\Rui Lopes\AppData\Roaming\Sublime Text 3\Packages\User). | |
# NB you can go into this directory by opening the Preferences | Browse Packages... menu. | |
# | |
# Add a shortcut to run this command by using sublime Preferences | Key Bindings - User: | |
# | |
# [ | |
# { | |
# "keys": ["ctrl+shift+j"], | |
# "command": "format_json" |