Skip to content

Instantly share code, notes, and snippets.

View peschkaj's full-sized avatar

Jeremiah Peschka peschkaj

View GitHub Profile
@peschkaj
peschkaj / DatastaxDriverTest.cs
Created July 8, 2013 22:39
Cassandra C# driver CassandraNoHostException
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cassandra;
using Cassandra.Data;
using Cassandra.Data.Linq;
using metrics.Core;
using metrics.Reporting;
using System.Diagnostics;
@peschkaj
peschkaj / riak.sh
Created July 18, 2013 21:44
Riak start/stop/teardown scripts
function riak_dev_cleanup_stage() {
for d in ~/Projects/riak/dev/dev{2,3,4,5}; do
$d/bin/riak-admin cluster leave;
done
~/Projects/riak/dev/dev1/bin/riak-admin cluster plan
}
function riak_dev_cleanup_commit() {
~/Projects/riak/dev/dev1/bin/riak-admin cluster commit
function riak_dev_cleanup_stage() {
for d in ~/Projects/riak/dev/dev{2,3,4,5}; do
$d/bin/riak-admin cluster leave;
done
~/Projects/riak/dev/dev1/bin/riak-admin cluster plan
}
function riak_dev_cleanup_commit() {
~/Projects/riak/dev/dev1/bin/riak-admin cluster commit
using System;
using CorrugatedIron;
using CorrugatedIron.Models;
using CorrugatedIron.Util;
using ProtoBuf;
namespace TestAllowMult
{
public class MainClass
{
# -*- shell-script -*-
function riak_dev_cleanup_stage() {
for d in ~/Projects/riak/dev/dev{2,3,4,5}; do
$d/bin/riak-admin cluster leave;
done
~/Projects/riak/dev/dev1/bin/riak-admin cluster plan
}

generated.cs is produced by Protobuf-net - you'll notice line 5's hilarious half-complete enumeration. This happens because CLR enums are value types and can't technically be null.

Corrected.cs contains my corrections on line 5. I think that this should let us get around these problems - it's good to know, though, because these do occur in a few other places in the protocol buffers interface.

@peschkaj
peschkaj / dynamic.sql
Last active December 25, 2015 16:39
An exciting adventure with dynamic SQL
SELECT * FROM Sales.SalesOrderHeader AS soh
CREATE INDEX jp_filters_not_offline
ON Sales.SalesOrderHeader (OrderDate)
INCLUDE (SalesOrderID)
WHERE OnlineOrderFlag <> 0
GO
#[test]
fn telemetry_cleanup_removes_old_files() {
setup(&|config| {
expect_ok(config, &["rustup", "default", "stable"]);
expect_ok(config, &["rustup", "telemetry", "on"]);
expect_ok(config, &["rustc", "--version"]);
let telemetry_dir = config.rustupdir.join("telemetry");
utils::ensure_dir_exists("telemetry",
void get_user_action(char input[MAX_INPUT_LENGTH])
{
bool validInput = false;
do
{
cout << HAND_MSG << endl;
cin.get(input, MAX_INPUT_LENGTH, '\n');
cin.ignore(100, '\n');
s_to_lower(input);
try {
Get-command -Name "git" -ErrorAction Stop >$null
Import-Module -Name "posh-git" -ErrorAction Stop >$null
$gitStatus = $true
} catch {
Write-Warning "Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder."
$gitStatus = $false
}
function checkGit($Path) {