Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View uintdev's full-sized avatar
🙂

André uintdev

🙂
View GitHub Profile
@uintdev
uintdev / EmailExtractor.cpp
Last active April 22, 2023 16:14
Email extractor but in C++ (test port)
/**
* 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.
@uintdev
uintdev / vlc_tts_buffer_oob_read_demo.cpp
Created October 17, 2022 17:11
VLC 3.x vlc_tick_to_str() buffer out-of-bounds read
/*
// 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,
@uintdev
uintdev / rainpix.py
Created March 7, 2019 23:19
rainpix
# 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 = ""
@uintdev
uintdev / hex2rgb.php
Created January 30, 2018 15:57
Hex to RGB conversion.
<?php
$str = 'ffffff';
$chartype = ctype_alnum($str);
$charcount = strlen($str);
if ($charcount === 3 && $chartype) {
$splitby = 1;
} else if ($charcount === 6 && $chartype) {
@uintdev
uintdev / sessidfverify.php
Last active April 6, 2017 19:40
PHP Session ID Format Verification
<?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);
@uintdev
uintdev / bbparser.php
Last active February 4, 2017 18:53
PHP BBCode Parser w/ line break support
<?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;