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
void FillRom(byte *buffer) { | |
for (int i=0x00; i<= 0x06; i++) { | |
buffer[i] = 0xEA; | |
} | |
//load A with 0x77 and push | |
buffer[0x07] = 0xA9; |
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 System; | |
using NUnit.Framework; | |
namespace RackspaceSoapTest | |
{ | |
[TestFixture] | |
public class Class1 | |
{ | |
[Test] | |
public void Test1() |
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 System; | |
using System.IO; | |
using System.Net; | |
using System.Text; | |
namespace TcpListener | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
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
public interface IGenericCache<T> | |
{ | |
TimeSpan CacheTtl { get; set; } | |
Func<T> LoadCache { get; set; } | |
T ReturnCache(); | |
T ForceRefresh(); | |
} | |
public class GenericCache<T> : IGenericCache<T> | |
{ |
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
// written by Steven Swenson | |
// Released under the MIT open source license... | |
// No warranty at all. use at your own risk. | |
public static class Tjson | |
{ | |
//https://gist.github.com/ctigeek/4950c4b07a50a0791f012858e3bb2214 | |
private static readonly Splitter.Preserver QuotePreserver = new Splitter.Preserver { Start = '"', End = '"', Escape = '\\' }; | |
private static readonly Splitter.Preserver CurlyBoiPreserver = new Splitter.Preserver { Start = '{', End = '}', Escape = '\\', Recursive = true, SubPreserver = QuotePreserver }; | |
private static readonly Splitter.Preserver BracketPreserver = new Splitter.Preserver { Start = '[', End = ']', Escape = '\\', Recursive = true, SubPreserver = QuotePreserver }; |
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
/// <summary> | |
/// Split a string while preserving sections of it. | |
/// Similar to string.Split, but you can define start-end characters (e.g. quotes, brackets, braces) inside of which it will NOT split. | |
/// Preservers can also be "recursive" which means it can determine if it's in nested brackets or parens, etc. | |
/// If the start & end characters are different, there's a good chance you want to set recursive to true. | |
/// See the associated unit test for an example that can parse json.... | |
/// Also supports escape characters so the separator and start-end characters can be ignored. | |
/// </summary> | |
public class Splitter |
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 System; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Security.Cryptography; | |
namespace EncryptionExample | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
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
public static class Retry | |
{ | |
public static void Do(Action action, TimeSpan retryInterval, int maxAttemptCount) | |
{ | |
try | |
{ | |
action(); | |
} | |
catch | |
{ |
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
function Import-XlsData($filePath) { | |
## You have to have these drivers... | |
##https://www.microsoft.com/en-us/download/confirmation.aspx?id=13255 | |
##The first row will be the column names | |
##This only looks at the first sheet. If you want a different sheet you'll have to adjust the table name retrieved from $schema. | |
$strProvider = "Provider=Microsoft.ACE.OLEDB.12.0" | |
$strDataSource = "Data Source=$filePath" | |
$strExtend = "Extended Properties='Excel 12.0;IMEX=1'" |
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
public static class Config | |
{ | |
public const int MaxValueLength = 7990; //If you change the size of the [secret] column then this needs to be changed. | |
public static string ConnectionString { get; set; } | |
public static string AesKey { get; set; } | |
public static int SecretPaddingSize { get; set; } = 1000; //e.g. any secret less than 1000 bytes will be padded so that it is at least 1000 bytes. This is to prevent information leaking regarding the size of the secret. Set to 0 to disable padding. |
NewerOlder