Check if variable is table (LUA)
Simple conditional to check whether a given variable is a table (as opposed to a string or integer) in LUA
Simple conditional to check whether a given variable is a table (as opposed to a string or integer) in LUA
By default, dmesg uses seconds of uptime for it's timestamps, which in less than useful if you're trying to quickly check the time an entry was logged at. Where available /var/log/kern.log can be used to get timestamped entries, but where not available the function below gives a dmesg analog with human readable timestamps
A quick reference for a number of common tasks using OpenSSL's s_client to connect to a SSL/TLS service, including checking expiry dates etc
My Android phone regularly disconnects and (immediately) reconnects to wifi. That's not a huge issue for buffered video streaming, but is an issue for VOIP, SSH connections etc. Plus I use Tasker to trigger actions when disconnected from a specific SSID, so it means the screen changes whilst those actions trigger.
Android's "smart network switch" was already turned off for causing similar issues, and the fix in my case seems to have been to disable Power-save for Wireless connections
Quick reference for mapping RFC 3986 encoded URI characters back to ASCII characters
Below are tables giving ascii character codes (in decimal) and their equivalent characters. Adding primarily as a quick place to check when I need to confirm a value
A pair of utility functions to handle parsing of querystring like strings in javascript
This may simply be a string rather than the querystring itself, so handles any string where key value pairs are ampersand (&) delimited
The encoder accepts an object, and will generate an & delimited string
Simple Javascript function to place a xmlhttp request (supporting a range of browsers) and trigger a callback function once the request has been satisfied
This is one of the functions I often find myself looking at older projects to find rather than re-writing it. Yes you can do the same with jQuery, but that's only really a valid route if you're already loading jQuery. Otherwise you're loading an entire framework for no real benefit
Takes an ASCII string and XOR's it against a given "key"
Basically a really crappy encryption mechanism, though it can be useful in cryptanalysis (as it's symmetrical)
Returns the resulting string in a hex encoded form
Short snippet to calculate the edit distance (or Hamming Distance) between two strings in Python
The Hamming distance is just the number of differing bits within the string, so given two single char strings:
The Hamming distance would be 2 as the penultimate and last bit differ.
The edit distance is useful in basic cryptanalysis as for some cipher types (basically mechanisms where the key is repeated, i.e. ECB) it can help you discern the length of the key used - out of multiple tries at the keysize, the smallest (normalised) edit distance probably best indicates the key used.