Skip to content

Instantly share code, notes, and snippets.

View pedoc's full-sized avatar
🎯
Focusing

pedoc pedoc

🎯
Focusing
View GitHub Profile
@pedoc
pedoc / simulate keyboard input
Created September 20, 2018 12:46
simulate keyboard input
public class Keyboard
{
public void Send(ScanCodeShort a)
{
INPUT[] Inputs = new INPUT[1];
INPUT Input = new INPUT();
Input.type = 1; // 1 = Keyboard Input
Input.U.ki.wScan = a;
Input.U.ki.dwFlags = KEYEVENTF.SCANCODE;
Inputs[0] = Input;
@pedoc
pedoc / ExtensionMethods.cs
Created July 2, 2018 10:03
byte[] -> hex string(with reversal)
public static class ExtensionMethods {
public static string ToHex(this byte[] data) {
return ToHex(data, "");
}
public static string ToHex(this byte[] data, string prefix) {
char[] lookup = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
int i = 0, p = prefix.Length, l = data.Length;
char[] c = new char[l * 2 + p];
byte d;
for(; i < p; ++i) c[i] = prefix[i];