Skip to content

Instantly share code, notes, and snippets.

Avatar

Andre uintdev

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am uintdev on github.
  • I am uintdev (https://keybase.io/uintdev) on keybase.
  • I have a public key ASDm2N6HTVM0LTPOzqIK3_uj3a2wmH6LnEJui_hTQoUKsQo

To claim this, I am signing this object:

View rainpix.py
# 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 Jan 30, 2018
Hex to RGB conversion.
View hex2rgb.php
<?php
$str = 'ffffff';
$chartype = ctype_alnum($str);
$charcount = strlen($str);
if ($charcount === 3 && $chartype) {
$splitby = 1;
} else if ($charcount === 6 && $chartype) {
@uintdev
uintdev / bbparser.php
Last active Feb 4, 2017
PHP BBCode Parser w/ line break support
View bbparser.php
<?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;
@uintdev
uintdev / sessidfverify.php
Last active Apr 6, 2017
PHP Session ID Format Verification
View sessidfverify.php
<?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 / antifloodpost.php
Last active Feb 4, 2017
Post Anti-Flooding Script
View antifloodpost.php
<?php
// ANTI-FLOOD SCRIPT START
$floodvalidation = 0; // validator
$floodd = 10; // flooded within this time frame (seconds)
$floodp = 2; // maximum flood posts allowed in (+1 auto)
$floodpro = mysqli_query($conn, "SELECT sender,time FROM ".$roomtb." WHERE sender='$logged' AND time > UNIX_TIMESTAMP(NOW())-$floodd ORDER BY id DESC LIMIT $floodp,$floodp"); // query
$floodpro = mysqli_num_rows($floodpro); // get result count
if($floodpro > 0 && $msg != '' && $msg != ' ') {
mysqli_query($conn, "UPDATE members SET flood='1' WHERE username='$logged'"); // prevent sending
$floodvalidation = 1; // block send session