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
static void Main(string[] args) | |
{ | |
/* | |
* Basic PoC of mouse movement & distance | |
* | |
* | |
*/ | |
Console.Title = "~~* Mouse Distance Poc *~~"; |
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
POINT currentMousePosition; | |
POINT previousMousePosition; | |
GetCursorPos(&previousMousePosition); | |
double mouseDistance = 0; | |
while (true) | |
{ | |
GetCursorPos(¤tMousePosition); | |
mouseDistance += sqrt( | |
pow(currentMousePosition.x - previousMousePosition.x, 2) + | |
pow(currentMousePosition.y - previousMousePosition.y, 2) |
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.Runtime.InteropServices; // For Pinvoke & Win Api | |
namespace ConsoleApp1 | |
{ | |
internal class Program | |
{ | |
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Ansi)] | |
public static extern int MessageBoxA(IntPtr hWnd, String text, String caption, uint type); | |
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] |
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 Bitmap CreateBitmapFromData(byte[] binaryData) | |
{ | |
// calc padding amount | |
int iPaddedSize = binaryData.Length + (3 - binaryData.Length % 3) + 6; | |
int iPixelCount = iPaddedSize / 3; | |
int iCountPerRow = (int)Math.Ceiling(Math.Sqrt(iPixelCount)); | |
Bitmap bmp = new Bitmap(iCountPerRow, iCountPerRow, PixelFormat.Format24bppRgb); | |
byte[] paddedData = new byte[iPaddedSize]; |
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.Runtime; | |
namespace CodeTest | |
{ | |
internal class Program | |
{ | |
/* | |
* Complete the 'countSubstrings' function below. | |
* The function is expected to return an INTEGER. | |
* The function accepts STRING input_str as parameter. |
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.Runtime.InteropServices; | |
using System.IO; | |
using System.Net.Mail; | |
namespace Stub | |
{ | |
class Program | |
{ | |
[DllImport("kernel32.dll", SetLastError = true)] |