Skip to content

Instantly share code, notes, and snippets.

View DevJohnC's full-sized avatar

John Carruthers DevJohnC

View GitHub Profile
private void ShutdownComputer(IDevice computer, ISecurityCredentials credentials)
{
ServiceHelper.Call<ShutdownResponse>(computer, new Shutdown(), credentials, (shutdownResponse, exception) =>
{
if (exception is API.Exceptions.PermissionDeniedException)
{
// pincode required for call, prompt user for it in full version
if (credentials == null)
{
var dummyCredentials = new API.Security.PinCode
//
// Author: John Carruthers (johnc@frag-labs.com)
//
// Copyright (C) 2013 John Carruthers
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
@DevJohnC
DevJohnC / gist:6577995
Created September 16, 2013 08:31
Clearly the best piece of code ever because it looks pretty in the console
Console.WriteLine("***************************************************");
Console.WriteLine("* *");
Console.WriteLine("* IMPORTANT *");
Console.WriteLine("* THIS SERVERS PUBLIC KEY FINGERPRINT IS *");
Console.WriteLine("* {0} *", fingerprint);
Console.WriteLine("* CHECK THIS FINGERPRINT WHEN ADDING NODES *");
Console.WriteLine("* *");
Console.WriteLine("***************************************************");
//
// Author: John Carruthers (johnc@frag-labs.com)
//
// Copyright (C) 2013 John Carruthers
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
//
// Author: John Carruthers (johnc@frag-labs.com)
//
// Copyright (C) 2013 John Carruthers
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
@DevJohnC
DevJohnC / ExampleScript.cs
Last active December 25, 2015 10:09
AdjutantOS example script
//
// Author: John Carruthers (johnc@frag-labs.com)
//
// Copyright (C) 2013 John Carruthers
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
//
// Author: John Carruthers (johnc@frag-labs.com)
//
// Copyright (C) 2013 John Carruthers
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
//
// Author: John Carruthers (johnc@frag-labs.com)
//
// Copyright (C) 2013 John Carruthers
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
@DevJohnC
DevJohnC / FilesystemModuleLoader.cs
Created October 25, 2013 03:30
Loading plugins/modules from the filesystem, key differences between Mono and .NET
//
// Author: John Carruthers (johnc@frag-labs.com)
//
// Copyright (C) 2013 John Carruthers
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
//
// Author: John Carruthers (johnc@frag-labs.com)
//
// Copyright (C) 2013 John Carruthers
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to