Skip to content

Instantly share code, notes, and snippets.

View glennblock's full-sized avatar

Glenn Block glennblock

View GitHub Profile
#creates A LOT of tokens
#!/bin/bash
for i in `seq 1 100000`;
do
stanza="[http://test$i]"
printf '\n\n%s\n' $stanza >> inputs.conf
printf 'disabled = 0\n' >> inputs.conf
guid=`uuidgen`
printf 'token = %s' $guid >> inputs.conf
done
@glennblock
glennblock / gist:ec1728e6c8570443e48a
Last active October 1, 2015 14:24
Clear your routing tables without rebooting
#drop this in your .bash_profile
alias fixvpn="sudo route -n flush && sudo networksetup -setv4off Wi-Fi && sudo networksetup -setdhcp Wi-Fi"
@glennblock
glennblock / index.js
Created September 21, 2015 16:58
JSLambda
var loggerFactory = require('./loggerFactory.js');
/**
* Only the token property is required.
* Defaults are listed explicitly.
*
* Alternatively, specify config.url like so:
*
* "https://localhost:8088/services/collector/event/1.0"
*/
alias fixvpn="sudo route -n flush && sudo networksetup -setv4off Wi-Fi && sudo networksetup -setdhcp Wi-Fi"
var db = CouchDb.Get("scriptcs");
> using Couchbase.Lite;
> var db = Manager.SharedInstance.GetDatabase("scriptcs");
Manager: Starting Manager version: 1.0.0-beta3
SqlitePCLRawStorageEngine: Error opening the Sqlite connection using connection String: C:\Users\Glenn Block\AppData\Local\scriptcs.cblite
System.TypeInitializationException: The type initializer for 'NativeMethods' threw an exception. ---> System.Exception: sqlite3.dll was not loaded.
at SQLitePCL.SQLite3Provider.NativeMethods..cctor()
--- End of inner exception stack trace ---
at SQLitePCL.SQLite3Provider.NativeMethods.sqlite3_open_v2(Byte[] filename, IntPtr& db, Int32 flags, Byte[] vfs)
at Couchbase.Lite.Shared.SqlitePCLRawStorageEngine.Open(String path)
Database
private static void BatchLoggingByBytes()
{
_listener = new HttpInputTraceListener(_host, _token, batchSizeBytes: 100);
_traceSource.Listeners.Add(_listener);
for (int i = 1; i <= 5; i++)
_traceSource.TraceEvent(TraceEventType.Information, i, string.Format("Boris {0}", i));
Prompt("Logged 5 events, data has not been sent yet as it did not hit 100 bytes, press enter to continue");
private static void BatchLoggingByInterval()
{
_listener = new HttpInputTraceListener(_host, _token, batchInterval:30000);
_traceSource.Listeners.Add(_listener);
for (int i = 1; i <= 5; i++)
_traceSource.TraceEvent(TraceEventType.Information, i, string.Format("Boris {0}", i));
ReadLine("Logged 5 events, data will be delayed by 30 seconds, press enter to continue");
}
private static void BatchLoggingByInterval()
{
_listener = new HttpInputTraceListener(_host, _token, batchInterval:60000);
_traceSource.Listeners.Add(_listener);
for (int i = 1; i <= 5; i++)
_traceSource.TraceEvent(TraceEventType.Information, i, string.Format("Boris {0}", i));
Console.Prompt("Logged 5 events, data will be delayed by 10 seconds, press enter to continue");
}