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
/** | |
* Last modified: 2nd April 2019 | |
* This was a test port from Python to see if C++ would trivally | |
* improve performance. In this case, the implementation resulted | |
* in far worse file extraction times in comparison to | |
* the Python counterpart. | |
* Of course, the Rust port, of which came out long after, had easily bet both. | |
* | |
* Presented is the snapshot of the last modification, | |
* with comments and what was commented out. |
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
/* | |
// VLC 3.x vlc_tick_to_str() (previously secstotimestr()) out-of-bounds read bug demo | |
// ./src/misc/mtime.c | |
// | |
// This is to illustrate an existing bug in VLC 3 builds. | |
// VLC 4 is not affected. Despite having similar code, it might have protections in place elsewhere. | |
// | |
// The large number of seconds from the selected media would be passed onto the unary minus operator. | |
// For context, int32_t is 32-bit signed integer. The given number exceeds the maximum. | |
// The unary minus operator has undefined behaviour when passing overflowing numbers, |
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
# rainpix.py | |
# a random coloured dot loop (gnu/linux only) | |
# i.e. python3 ./rainpix.py 50 | |
import sys | |
import random | |
def loopy(char, amount): | |
# initilise variables | |
spacing = "" |
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
<?php | |
$str = 'ffffff'; | |
$chartype = ctype_alnum($str); | |
$charcount = strlen($str); | |
if ($charcount === 3 && $chartype) { | |
$splitby = 1; | |
} else if ($charcount === 6 && $chartype) { |
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
<?php | |
function bb_parse($string) { | |
$string = str_replace("\r\n", "\r", $string); | |
$tags = 'b|i|s|u|rain'; | |
while (preg_match_all('`\[('.$tags.')=?(.*?)\](.+?)\[/\1\]`', $string, $matches)) foreach ($matches[0] as $key => $match) { | |
list($tag, $param, $innertext) = array($matches[1][$key], $matches[2][$key], $matches[3][$key]); | |
switch ($tag) { | |
case 'b': $replacement = "<b>$innertext</b>"; break; | |
case 'i': $replacement = "<i>$innertext</i>"; break; | |
case 's': $replacement = "<s>$innertext</s>"; break; |
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
<?php | |
# INFO ABOUT PHP SESSION ID COOKIE | |
define('SERVER_SESS_ID', session_id()); | |
define('SERVER_SESS_CHAR', '26'); | |
# PHP SESSION ID FORMAT VERIFICATION | |
if(isset($_COOKIE[SERVER_SESS_ID])) { | |
if (!preg_match('/^[a-z0-9]{'.SERVER_SESS_CHAR.'}$/', $_COOKIE[SERVER_SESS_ID])) { | |
setrawcookie(SERVER_SESS_ID, '', 1, '/', null, null, true); |