Author image

Regular Expression tutorial

Regular expressions are sequences of characters and symbols to be searched for (CTRL + F) within a longer piece of text.

Here I summarize my personal notes on regexps, awk, sed, grep and C++ regexps, Java regexps, Python regexps, Bash (linux shell) regexps, Javascript (regexps), PHP (regexps) etc.

For example to create a pattern that matches only the numbers out of this character sequence: 917-555-1234 and 646.867-5309 stop it!

use \d{3}[-.]\d{3}[-.]\d{4}

in PCRE regexp dialect.

But what are all these cryptic runes and sequences? Let's find out. Read on!

Meta Characters

  • \g : global matching, matches found in entire text
  • \G : matches the end of previously...

Author image

Unity Pong

I made this time years ago as I was playing around trying to get a grasp of the Unity game engine.

Made on Windows 8.1 x86_64 with Unity 2017.2.0f3 and Visual Studio 2015 (solution upgraded to 2017 now).

Author image

Valiant Keygen

A keygen written in Python, released for educational purposes.

A key generator, or keygen for short, is a program, used in cryptography, that aims to beget a random number that can be used for encryption and decryption at 2 ends of a communication channel.

Brief walkthrough the code: We create a string key given a number of possible characters (here all alphanumeric chars in caps and without, as well as all 10 numbers) and we compute its checksum through a trivial hash function here (ord). We accumulate the result and we crosscheck with foundValueThroughDbg to figure out if the number we found has any relevance to the value found through the debugger. If we find at...

Author image

WinAPI KeyLogger

A basic WinApi keylogger that records keystrokes and writes them to a file.

There is an infinite loop, which checks every possible button (using GetAsyncKeyState), every 10ms, and records it to the file.

There is exception checking added in as well, for good measure.

I used Windows 8.1 x86_64, Visual Studio 2017, Modern C++17 to build the project.


Github repository link.

Author image

Windows Leak Checker

Memory Leak checking facility for Windows.

Simply integrate the files to your own program and test if you have any memory leaks.

You don't have to reference that code in your own files. It will do everything on its own, so long as you add the files to your program and compile them.

Note that it works only in debug mode!

Simple as that. : )

I used Windows 8.1 x86_64, Microsoft Visual Studio 2017 to build the project.


Github repository link.

Author image

Windows Shutdown Restart Logoff

Even wanted to have a script to shutdown/restart/sign-out your windows PC with the press of a button?

Well, now you can! Simple as that. Nothing more nothing less. The code is slim & thoroughly commented and other than some API functions which you can look up online on the Microsoft documentation (MSDN) it's pretty straightforward.

I used Windows 8.1 x86_64, Visual Studio 2017 to build the project.


Github repository link.


WIN API function

Author image

Minimal XAudio v2.8 Windows library

A high performance minimal XAudio 2.8 based library developed from scratch. It is almost as low level as one can get in Windows; such is the nature of XAudio2. I made it to use it in a Direct3D game engine but it doesn't require Direct3d and can be used for whatever purpose on the Windows platform.

XAudio2 delegates sounds to the WASAPI backend. You don't need multiple threads for each playing sound; these are managed internally by WASAPI which mixes & matches them internally as it best sees fit.

I used:

  • Windows 8.1 x86_64, Microsoft Visual Studio 2017
  • XAudio v2.8
  • X3DAudio

If you're on Windows 10 you can use XAudio v2.9 dll without much, if any, change.

If you'd prefer a more graphical approach, I have a QT audio player project.


SoundManager is a...

Author image

Set-Bit Sort in MIPS Assembly & C/C++

In this project we will dig deep into the MIPS64 architecture innards to understand the role of pipelining in a CPU. We'll be using the free & open source emulator EduMIPS64 which is written in Java. The emulator supports a subset (indeed the majority) of the MIPS64 architecture's instruction set repertoire. We will attempt to optimize and thus minimize the execution time of the program.

To test drive it, we will put together a program which processes an unsorted table of 120 signed integer numbers xi and performs the following computation:

  • counts the number of ones (bit = 1) in the binary representation of each number and sorts them in increasing order of their number of one-bits. In case there are numbers with equal set-bits sort them in increasing order of their arithmetic value.

We won't be using console input for the numbers, they will reside in a file.

The following...

Author image

Butterworth, Sallen-Key & Chebyshev Filter Analysis, Design and Synthesis

I separate the implementation in several parts as outlined below.

Part A.
A1. Design a normalized low-pass filter with Butterworth response, cutoff rate equal to 18dB/octave and maximum allowed gain deviation in the pass region equal to amax = 1.5 dB.
A2. Implement the normalized filter by connecting in cascade multiple sections. All capacitors must be identical. For the implementation of the second section, use a Sallen-Key filter with identical resistors and identical capacitors (Design II).
A3. Depict the logarithmic gain curve as calculated from the transfer function of the design along with the transfer function of the circuit.
A4. Denormalize the circuit such that the cutoff frequency become f
c = 1.6 kHz and the resisters be at their normal values with dimensions. Sketch the logarithmic gain curve of the denormalized circuit given frequency f (logarithmic axis)....

Author image

Fix Windows Boot issues - Your PC needs to be repaired | The drive where Windows is installed is locked

I have wrestled a few times with this unsurprisingly common BSOD, both with my own computer and on friends'. A quick online search led me to believe that many are suffering from it, so I thought about making this post to help somebody out. I know it can be alarming to see such an error for the first time, as it's a BSOD error basically totally preventing you from using your computer. But go through this article and with a little patience, we can, and we will, fix it together. (Honest!)

1 ... 3 4 5 6 7