Skip to content

Instantly share code, notes, and snippets.

View glennblock's full-sized avatar

Glenn Block glennblock

View GitHub Profile
// cj write template
{
"template" : {
"data" : [
{"name" : "qwe", "value" : ""},
{"name" : "rty", "type" : "part"}
]
}
}
@glennblock
glennblock / non_scripty_way.csx
Last active August 29, 2015 13:56
Script packs as script
public class WebApi : IScriptPackContext {
public WebApi(ILog logger, IControllerTypeManager typeManager) {
...
}
}
public class WebApiScriptPack : IScriptPack
{
private readonly ILog _logger;
private readonly IControllerTypeManager _typeManager;

9.6 PUT

The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server.

If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI.

If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request. If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be given that reflects the nature of the problem. The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not understand or impleme

//modinput.js
//A few prototypes namely Arg and Event are introduced to make the code more readable, toolable (syntax completion in editors/ides)
//and less error prone.
var splunk = require('splunk-sdk');
var mod = splunk.modularInput;
var logger = mod.logger;
// logger.info(..);
// logger.error(..);
@glennblock
glennblock / webapibook_alps.xml
Last active August 29, 2015 13:57
ALPS profile document for issue tracking
<alps version="1.0">
<doc>Issue tracking profile</doc>
<descriptor id="id" type="semantic"/>
<descriptor id="title" type="semantic"/>
<descriptor id="description" type="semantic"/>
<descriptor id="status" type="semantic"/>
<descriptor id="self-collection" type="safe"/>
<descriptor id="self-item" type="safe"/>
<descriptor id="issue" type="semantic">
<descriptor href="#self-item"/>
using (var searchResultsReader = await service.SearchExportAsync("search index=_internal | head 1000"))
{
Console.WriteLine("Begin: Service.SearchExportAsync: Asynchronous use case");
int recordNumber = 0;
int setNumber = 0;
foreach (var resultSet in searchResultsReader)
{
Console.WriteLine(string.Format("Result set {0}", ++setNumber));
var manualResetEvent = new ManualResetEvent(true);
Building: ScriptCs.Contracts (Debug)
Build started 4/10/2014 8:18:13 AM.
__________________________________________________
Project "/Users/glennblock/src/scriptcs/src/ScriptCs.Contracts/ScriptCs.Contracts.csproj" (Build target(s)):
Target PrepareForBuild:
Configuration: Debug Platform: AnyCPU
Target GenerateSatelliteAssemblies:
Cleaning Solution: splunk-sdk-csharp-pcl (Debug)
Cleaning Solution: 1. src (Debug)
Cleaning: Splunk.Client (Debug)
Build started 5/1/2014 3:50:07 PM.
__________________________________________________
Project "/Users/glennblock/src/splunk/splunk-sdk-csharp-pcl/src/Splunk.Client/Splunk.Client.csproj" (Clean target(s)):
@glennblock
glennblock / gist:e30f0fd1f4ed44213666
Last active August 29, 2015 14:01
Scriptcs mono install

These are the manual steps to get scriptcs mono installed locally.

  1. Create a folder for scriptcs i.e '~/scriptcs'
  2. Go to the scriptcs [nightly feed] (https://www.myget.org/gallery/scriptcsnightly) and find out the latest version of the ScriptCs package and download it by clicking on the file icon.
  3. Rename the downloaded file to have a .zip extension.
  4. Extract the package.
  5. Copy all the files in the ./tools/scriptcs folder to your scriptcs installation folder.
@glennblock
glennblock / http.csx
Last active August 29, 2015 14:01
Helper script for talking to the issue tracker using the scriptcs REPL
/*
To use, drop this into the current folder. Then open the scriptcs REPL with the helper functions laoded.
run "scriptcs http.csx -r"
Start the issue tracker API self-host cloned from https://github.com/webapibook/issuetracker, by building and running the self-host project.
To pull down the collection and dump to the REPL.