Skip to content

Instantly share code, notes, and snippets.

@ovidiu-ionescu
ovidiu-ionescu / create_dummy_interface.sh
Created February 11, 2020 21:32
Create a dummy network interface in Linux
#!/bin/bash
# Creates a dummy network interface, useful for running a local server
SUDO=''
if (( $EUID != 0 )); then
SUDO='sudo'
fi
NAME=organizator
$SUDO ip link add $NAME type dummy
@ovidiu-ionescu
ovidiu-ionescu / create_network_namespaces.sh
Last active February 15, 2020 20:39
Creates a network namespace and a network connection between that and the current namespace. Can run multiple servers on the same port and all interfaces
#!/bin/bash
if (( $EUID != 0 )); then
echo "Please run this as sudo $0" >&2
exit 1
fi
function create_space {
NS=$1
@ovidiu-ionescu
ovidiu-ionescu / nginx_client_certificates.sh
Last active February 21, 2020 20:03
Create a self signed certificare and a client certificate to authenticate to nginx
#!/bin/bash
# @author Ovidiu Ionescu
# This script generates client certificates for browser authentication
if [ $# -lt 2 ]; then
echo "Usage: $0 name email"
exit 1
fi
NAME=$1
@ovidiu-ionescu
ovidiu-ionescu / gist:844f000ce26b0a6d1b0277d515e49a0e
Last active April 16, 2020 10:18
Reversing a String in Java
new StringBuilder(str).reverse().toString()
@ovidiu-ionescu
ovidiu-ionescu / split_dns.ps1
Last active June 27, 2023 16:03
Manipulate the Nrpt table in Windows to enable split DNS
# Remove all existing entries
Get-DnsClientNrptRule |ForEach { Remove-DnsClientNrptRule -Name $_.Name -Force }
# Everything ending in domain.com gets resolved by the specified DNS servers
Add-DnsClientNrptRule -Namespace ".domain.com" -NameServers @("10.0.0.10", "10.0.0.11")
# see what's in the table
Get-DnsClientNrptRule