Using __builtin_offset for data encapsulation in C

Categories: Uncategorized

I ran into __builtin_offset in the VLC codebase where they used it to implement a macro called ‘container_of’ (which according to some research I did online, originated from the linux kernal codebase). #define container_of(ptr, type, member) \ ((type *)(((char *)(ptr)) – offsetof(type, member))) I found it used in this way // This struct is intended […]

Little-Known Awesome Algorithms: Fenwick Trees

Categories: Uncategorized

Contrived Use Case Imagine that we are creating an analytics tool for a financials brokerage, where orders are coming in all the time. Let’s say we’re interested in knowing how many orders fall between a certain value (a range query), in real-time. Lets say that orders can fall between $0.01 and $5M, and we want to let our […]

How to program a Gaussian Blur without using 3rd party libraries

Categories: Uncategorized

  What is a Gaussian Blur? Something I found fairly difficult to find online was a simple explanation on how to implement my own Gaussian Blur function. This article will explain how to implement one. The basic idea behind a Gaussian Blur is that each pixel becomes the average of the pixels around it, sort of. Instead […]

Over-the-wire Natas28 Security Puzzle

Categories: Uncategorized

You are given a search tool which finds jokes which contain your search term. The form submission returns a 302 redirect to another page with an encrypted get param already attached. This encrypted param must contain your input in some way. They look something like this: G%2BglEae6W%2F1XjA7vRm21nNyEco%2Fc%2BJ2TdR0Qp8dcjPIWwm0xpPpp9XnS4%2FRG86COn7KRweZpSA6OMfSSZI8b4nOKX%2FtKRQAkZ3UXWuWWu9bzTfM5xp7c4R9mULvO1icC The data is url encoded and base 64 […]

Android: getCallingPackage returns null and an alternative

Categories: Uncategorized

If you ever want to verify the package name of an application which is deeplinking into you, you might take a look at Activity’s ‘getCallingPackage’. The gotcha here is that this will always be null unless the activity was started with startActivityForResult. Unfortunately, setActivityForResult may not work for your app (especially if it requires changing […]

Option Delta vs Actual % In-The-Money

Categories: Uncategorized

Been playing around with options for the last few months and recently I purchased my first batch of historical CBOE options data. This is my first piece of research with the data-set. Delta is frequently used as an approximation for the probability of an option expiring in the money (This is different from probability of […]

Formula for Houdini Fit Range VOP node

Categories: Uncategorized

((value – source_min) / (source_max – source_min)) * (dest_max – dest_min) + dest_min   This matches up with the output for both clamped and unclamped.

Using Print Nodes within Material Shader Builder to Debug Houdini VOPs

Categories: Uncategorized

Above is a video of what I’m about to explain. If you’re working with VOP nodes to build a material shader builder then there’s a special procedure you have to follow to get the Print node working. The Print node lets us send text to the Houdini console, but there’s extra steps necessary in this […]