Skip to content

Instantly share code, notes, and snippets.

View corytodd's full-sized avatar

Cory Todd corytodd

View GitHub Profile
@corytodd
corytodd / bitbucket_team_repos.py
Created August 9, 2015 17:56
Python Bitbucket helper
from rauth import OAuth1Service
import BaseHTTPServer
import threading,time
import webbrowser
import urlparse
class Config(object):
def __init__(self):
# Create a new consumer at https://bitbucket.org/account/user/{username}/api
self.consumer_key = <YOUR_KEY>
@corytodd
corytodd / CodeGolf_NotLogic.nim
Last active August 29, 2015 14:18
Version with some breathing room...
proc s(x, y, b: var int)=
x = x div 2
y = y div 2
b *= 2
proc n(x: var int): int =
return -(x+1)
proc a(x, y: var int): int =
var b = 1
@corytodd
corytodd / gist:77d4169839b4902e8cbc
Created November 22, 2014 19:42
Test MS Virtual Serial Port driver sample
using System;
using System.IO.Ports;
namespace VCPTest
{
class Program
{
static bool _continue;
static SerialPort _serialPort;
@corytodd
corytodd / gist:11165166
Created April 22, 2014 04:14
Unit Test Async
/// <summary>
///A test for calibrate wifi
///</summary>
[TestMethod()]
public void CalibrateWifi_Test()
{
ICommDevice target = CTalk.Calibrate();
Action<byte> callback = new Action<byte>((byte b) => Assert.IsTrue(b == (byte)CTalkCommand.Code.ACK));
PTalk.CalibrateWifitarget, callback);
}
using System;
using System.IO.Ports;
class PortDataReceived
{
public static void Main()
{
SerialPort portA = new SerialPort("COM7");
internal static string Decrypt(byte[] key,string input)
{
if (input == null || input.Length <= 0)
throw new ArgumentNullException("input");
if (key == null || key.Length <= 0)
throw new ArgumentNullException("Key");
var un64byte = Convert.FromBase64String(input);
if (un64byte.Length < 16)
return ""; // Too short