Skip to content

Instantly share code, notes, and snippets.

img1

1. Configuring an Isolated Network

To set up an isolated Network, log into your controller and go to Settings->Networks and click on the +Create New Network button. This opens up the “Create New Network” page, where you need to provide a few details. First off, give the network a name and select Corporate as the Network Purpose. I left the default Network Group of LAN1 in place, since I don’t have anything connected to the LAN2 port of my USG.

1.1 Define a VLAN

Next up, define a VLAN ID that you want to use for this network. This can be any number from 0 to 4095, and you can pick whatever you want here (as long as it’s not 0, which is the default VLAN for everything that doesn’t have one defined).

@dunderrrrrr
dunderrrrrr / unifi_ubuntu_2004.sh
Created November 28, 2020 17:22
Install Ubiquiti Unifi Controller on Ubuntu 20.04
# Install Ubiquiti Unifi Controller on Ubuntu 20.04.
# As tested on a fresh install of ubuntu-20.04.1-live-server, August 22nd 2020.
# Thanks to https://gist.github.com/tmuncks for posting the updated install steps.
sudo apt update
sudo apt install --yes apt-transport-https
echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg

Simple telegram-bot message from a bot.

#!/usr/bin/python3

import requests

t_url = "https://api.telegram.org/bot"
t_token = "" # your telegram bot token
t_group = "" # telegram group id

SSH

First, enable SSH on your ESXi host (if not already enabled).
Connect to ESXi IP address, go to Actions and then select Services and Enable Secure Shell (SSH).

USB Arb. Service

You have to stop USB Arbitrator Service. The service is used to passthrough the USB devices from hosts to a virtual machine. Once stopped, you will not be able anymore to passthrough USB devices to VMs.

# /etc/init.d/usbarbitrator stop 
@dunderrrrrr
dunderrrrrr / quick-openvpn-setup.md
Last active September 24, 2020 05:59
Superfast openvpn setup.

Get the script.

$ wget https://git.io/vpn -O openvpn-install.sh
$ chmod +x openvpn-install.sh

Run the script and follow instructions.

@dunderrrrrr
dunderrrrrr / fail2ban-userchange.md
Created March 4, 2020 18:25
Grant another user access to fail2ban-client

To grant another user access to fail2ban-client status and fail2ban-client status <jail> you need to do some tinkering.

I submitted an issue on Fail2ban's Github here and got a great response from @sebres.

Here's how to.

systemctl process

In /lib/systemd/system/fail2ban.service add User= in the [Service] section.

@dunderrrrrr
dunderrrrrr / deploy-vuejs-app-using-docker.md
Last active February 24, 2020 18:23
Deploy a vuejs application with nginx and docker.

If you have a finished vuejs app you'd like to deploy to a production server, follow these guidelines.

We'll use nginx with docker to run our app.

Install docker

Install docker.

Create dockerfile

Create a Dockerfile file in the root of your project.

@dunderrrrrr
dunderrrrrr / building-pip-packages.md
Last active February 24, 2020 12:16
Let's say you want to be able to run `pip install mypackage`. Here we'll explain how.

Let's say you want to be able to run pip install mypackage. Here we'll explain how.

Register on pypi

First of all, register yourself on PyPI. Make sure you also have a Github account.

Install required tools

You can do this inside a virtualenv (or outside if you want to skip this step in the future).

$ pip install --upgrade pip setuptools wheel
$ pip install tqdm
@dunderrrrrr
dunderrrrrr / arguments-with-argsparse.md
Created February 21, 2020 13:44
The argparse module makes it easy to write user-friendly command-line interfaces.

The argparse module makes it easy to write user-friendly command-line interfaces. The program defines what arguments it requires, and argparse will figure out how to parse those out of sys.argv. The argparse module also automatically generates help and usage messages and issues errors when users give the program invalid arguments.

Basic template

import argparse

if __name__ == '__main__':
    parser = argparse.ArgumentParser()

 # args goes here
@dunderrrrrr
dunderrrrrr / generate-html-with-python-jinja2.md
Created February 21, 2020 13:44
Jinja2 is one of the most used template engines for Python.

Jinja2 is one of the most used template engines for Python. It is inspired by Django's templating system but extends it with an expressive language that gives template authors a more powerful set of tools. On top of that it adds sandboxed execution and optional automatic escaping for applications where security is important.

Installing

Usually this is done inside a python virtualenv.

$ pip install jinja2

Usage