Skip to content

Instantly share code, notes, and snippets.

View Gaurav-Singh-97's full-sized avatar

Gaurav Singh Gaurav-Singh-97

View GitHub Profile
@lmas
lmas / djb2.go
Created June 12, 2017 16:14
djb2, a non-cryptographic hash function
package djb2
// For when you ever need to implement a dictionary hash function,
// that's good enough, simple and fast.
//
// WARNING:
// Not cryptographicly secure!
//
// Source: https://en.wikipedia.org/wiki/DJB2
//
@wellingtonlee
wellingtonlee / vuln.php
Created November 27, 2016 20:47
SQL Injection Vulnerable PHP
$sql_username = "root";
$sql_password = "forensics";
$db_name = "vuln";
if (isset($_GET['username']))
{
$username = $_GET['username'];
$password = $_GET['password'];
}
@shobhit6993
shobhit6993 / segmentTree_lazy_min.cpp
Last active June 6, 2023 21:24 — forked from Se7soz/lazy_segment_tree.cpp
C++ implementation of segment tree with lazy propagation.
/**
* In this code we have a very large array called arr, and very large set of operations
* Operation #1: Increment the elements within range [i, j] with value val
* Operation #2: Get max element within range [i, j]
* Build tree: build_tree(1, 0, N-1)
* Update tree: update_tree(1, 0, N-1, i, j, value)
* Query tree: query_tree(1, 0, N-1, i, j)
* Actual space required by the tree = 2*2^ceil(log_2(n)) - 1
*/