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
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 |
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.Ports; | |
class PortDataReceived | |
{ | |
public static void Main() | |
{ | |
SerialPort portA = new SerialPort("COM7"); |
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> | |
///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); | |
} |
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.Ports; | |
namespace VCPTest | |
{ | |
class Program | |
{ | |
static bool _continue; | |
static SerialPort _serialPort; |
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
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 |
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
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> |
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
http://stackoverflow.com/questions/9023129/algorithm-for-bit-expansion-duplication | |
We are isolating each nibble, then each bit per the expansion factor (3 in this case) | |
out = (in | in << 8) & 0x0F00F; | |
out = (out | out << 4) & 0x0C30C3; | |
out = (out | out << 2) & 0x249249; | |
out *= 7; | |
== 0000 0000 0000 0000 1101 0101 (in == 0xD5) |
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
#!/bin/sh | |
# Makefile fixer | |
# Some old projects that have been touched by dumb text editors | |
# may have had their makefile tabs turned in spaces. For large | |
# projects, this is a pia to fix. Use this script in your project | |
# directory as a quick fix. +1 for the expand command. | |
set -e | |
old="$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
from xml.dom import minidom | |
from subprocess import check_output | |
#Set this to the Visual Studio output directory, no trailing \ | |
path = 'X:\absolute\path\tp\publish\directory' | |
#Typically found as MyApp.application in the publish directory | |
app = "MyApp" | |
#Path to Mage.exe. Notice the delimented \v | |
mage = '"C:\Program Files (x86)\Microsoft SDKs\Windows\\v7.0A\Bin\mage.exe"' |
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
import javafx.animation.KeyFrame; | |
import javafx.animation.KeyValue; | |
import javafx.animation.Timeline; | |
import javafx.geometry.Point3D; | |
import javafx.scene.image.Image; | |
import javafx.scene.image.ImageView; | |
import javafx.scene.layout.StackPane; | |
import javafx.scene.transform.Rotate; | |
import javafx.util.Duration; |
OlderNewer