Skip to content

Instantly share code, notes, and snippets.

View vip3r011's full-sized avatar
🏠
Working from home

vip3r011

🏠
Working from home
  • ZA
View GitHub Profile
@vip3r011
vip3r011 / SecureRandomGenerator.java
Created June 1, 2018 11:21 — forked from kaworu/SecureRandomGenerator.java
dieharder on java's SecureRandom and OpenBSD arc4random(3)
/*
* 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;
@vip3r011
vip3r011 / block-tor-exit-nodes-iptables.md
Created May 24, 2018 10:39 — forked from jkullick/block-tor-exit-nodes-iptables.md
Block Tor Exit Nodes with IPTables
  1. Install ipset:
apt-get install ipset
  1. Create new ipset:
ipset create tor iphash
@vip3r011
vip3r011 / verify-uuid.php
Created May 23, 2018 10:13 — forked from Joel-James/verify-uuid.php
Check if UUID is in valid format
<?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 22:47 — forked from jcxplorer/uuid.js
UUID v4 generator in JavaScript (RFC4122 compliant)
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);
}
@vip3r011
vip3r011 / gist:e72c6cffbc222bfb61775b653b1d5690
Created March 24, 2018 12:13 — forked from jdeoliveira/gist:4080656
Dump/restore a postgres database in binary format for distribution
/Library/PostgreSQL/9.1/bin/pg_dump --host localhost --port 5432 --username <USERNAME> -b -c -E UTF-8 --no-owner --no-privileges --no-tablespaces --clean --schema public -F c -Z 9 -f <BACKUPFILENAME> <DATABASENAME>
/Library/PostgreSQL/9.1/bin/pg_restore --host localhost --port 5432 --username <USERNAME> --dbname <DATABASENAME> --no-owner --no-privileges --no-tablespaces --clean --schema public "<BACKUPFILENAME>"