Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

vip3r011

🏠
Working from home
View GitHub Profile
View gist:22123b43ee30e3ab4496321993aaa8aa
#!/bin/sh
#in your php.ini set session.gc_probability = 0
#this disables php GC
# put this script via cron
# or in /etc/cron.hourly
/usr/bin/php -d session.save_path=/var/lib/php/session -d session.gc_probability=1 -d session.gc_divisor=1 -d session.gc_maxlifetime=3600 -r "session_start(); session_destroy();"
@vip3r011
vip3r011 / hex_to_string.php
Created Mar 20, 2021
hex to string in PHP
View hex_to_string.php
<?php
function hex_to_string ($hex) {
if (strlen($hex) % 2 != 0) {
throw new Exception('String length must be an even number.', 1);
}
$string = '';
for ($i = 0; $i < strlen($hex) - 1; $i += 2) {
$string .= chr(hexdec($hex[$i].$hex[$i+1]));
}
View randomstuff.php
<?php
function randomInt(int $min, int $max) :int
{
$getFloat = function()
{
$bytes = random_bytes(7);
$bytes[6] = $bytes[6] | chr(0xF0);
$bytes .= chr(63); // exponent bias (1023)
$float = unpack('d', $bytes)[1];
@vip3r011
vip3r011 / dist.php
Last active Nov 14, 2020
distribution
View dist.php
<?php
function randomInt(int $min, int $max) :int
{
if (!is_int($min)) {
throw new \Exception('First parameter ($min) must be an integer');
}
if (!is_int($max)) {
throw new \Exception('Second parameter ($max) must be an integer');
View SecurityConfiguration.java
package com.gpch.login.configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@vip3r011
vip3r011 / detectWebGL.js
Created Sep 25, 2018 — forked from SeanZoR/detectWebGL.js
Detect WebGL with JS in browser
View detectWebGL.js
/**
* Detects if WebGL is enabled.
* Inspired from http://www.browserleaks.com/webgl#howto-detect-webgl
*
* @return { number } -1 for not Supported,
* 0 for disabled
* 1 for enabled
*/
function detectWebGL()
{
@vip3r011
vip3r011 / SecureRandomGenerator.java
Created Jun 1, 2018 — forked from kaworu/SecureRandomGenerator.java
dieharder on java's SecureRandom and OpenBSD arc4random(3)
View SecureRandomGenerator.java
/*
* SecureRandomGenerator.java
*
* Output a lot of (random) stuff on stdout.
*/
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.SecureRandom;
View block-tor-exit-nodes-iptables.md
  1. Install ipset:
apt-get install ipset
  1. Create new ipset:
ipset create tor iphash
@vip3r011
vip3r011 / verify-uuid.php
Created May 23, 2018 — forked from Joel-James/verify-uuid.php
Check if UUID is in valid format
View verify-uuid.php
<?php
/**
* Check if a given string is a valid UUID
*
* @param string $uuid The string to check
* @return boolean
*/
function isValidUuid( $uuid ) {
if (!is_string($uuid) || (preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/', $uuid) !== 1)) {
@vip3r011
vip3r011 / uuid.js
Created May 22, 2018 — forked from jcxplorer/uuid.js
UUID v4 generator in JavaScript (RFC4122 compliant)
View uuid.js
function uuid() {
var uuid = "", i, random;
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += "-"
}
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}